From da3ef3a27296d643bd489592fa09f54b1802f902 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 16 Sep 2009 11:45:54 +0000 Subject: CWS-TOOLING: integrate CWS l10nframework01 --- sd/sdi/makefile.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sd/sdi') diff --git a/sd/sdi/makefile.mk b/sd/sdi/makefile.mk index a442c65e8d64..f49d5103e2f5 100644 --- a/sd/sdi/makefile.mk +++ b/sd/sdi/makefile.mk @@ -41,6 +41,7 @@ SVSDIINC=$(PRJ)$/source$/ui$/inc # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk +.IF "$(L10N_framework)"=="" # --- Files -------------------------------------------------------- @@ -86,5 +87,5 @@ SVSDI2DEPEND= \ $(PRJ)$/inc$/app.hrc # --- Targets ------------------------------------------------------- - +.ENDIF .INCLUDE : target.mk -- cgit v1.2.3 From 5d431414afa79d392fe6a885940c559236c25aa2 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 16 Sep 2009 13:55:36 +0000 Subject: CWS-TOOLING: integrate CWS impressnotes01 2009-09-11 13:52:41 +0200 cl r276061 : CWS-TOOLING: rebase CWS impressnotes01 to trunk@276043 (milestone: DEV300:m58) 2009-09-10 15:44:57 +0200 cl r276039 : #i103139# continued work on the impress annotation feature 2009-09-10 14:52:31 +0200 cl r276032 : #i103139# continued work on the impress annotation feature 2009-09-10 14:50:32 +0200 cl r276031 : #i103139# continued work on the impress annotation feature 2009-09-10 14:48:29 +0200 cl r276030 : #i103139# continued work on the impress annotation feature 2009-09-10 11:36:11 +0200 cl r276027 : #i103139# continued work on the impress annotation feature 2009-09-09 20:22:41 +0200 cl r276018 : #i103139# continued work on the impress annotation feature 2009-09-09 20:21:45 +0200 cl r276017 : #i103139# continued work on the impress annotation feature 2009-09-09 19:32:29 +0200 sj r276015 : #i103139# added import of comments (ppt binary) 2009-09-09 19:31:07 +0200 sj r276014 : #i103139# added import of comments (ppt binary) 2009-09-09 19:16:41 +0200 cl r276011 : #i103139# continued work on the impress annotation feature 2009-09-09 19:15:19 +0200 cl r276010 : #i103139# continued work on the impress annotation feature 2009-09-09 16:27:19 +0200 cl r276001 : #i104579# fixed isEmptyPresObj() 2009-09-09 15:12:02 +0200 cl r275997 : #i103139# continued work on the impress annotation feature 2009-09-09 15:06:29 +0200 sj r275996 : #i103139# added import of comments (ppt binary) 2009-09-09 14:53:01 +0200 cl r275995 : #i103139# continued work on the impress annotation feature 2009-09-09 14:51:32 +0200 cl r275994 : #i103139# continued work on the impress annotation feature 2009-09-09 12:11:17 +0200 cl r275982 : #i103139# continued work on the impress annotation feature 2009-09-09 11:47:55 +0200 cl r275981 : #i103139# continued work on the impress annotation feature 2009-09-09 11:47:23 +0200 cl r275980 : #i103139# continued work on the impress annotation feature 2009-09-09 11:44:47 +0200 cl r275978 : #i104315# added missing tab pages 2009-09-08 16:04:44 +0200 cl r275936 : #i103139# continued work on the impress annotation feature 2009-09-08 16:03:28 +0200 cl r275935 : #i103139# continued work on the impress annotation feature 2009-09-08 11:45:47 +0200 cl r275920 : #i103139# continued work on the impress annotation feature 2009-09-08 11:41:51 +0200 cl r275919 : #i103139# continued work on the impress annotation feature 2009-09-07 18:30:55 +0200 cl r275910 : #i103139# continued work on the impress annotation feature 2009-09-07 18:29:37 +0200 cl r275909 : #i103139# continued work on the impress annotation feature 2009-09-07 17:25:43 +0200 cl r275905 : #i103139# continued work on the impress annotation feature 2009-09-07 12:00:28 +0200 cl r275884 : #i103139# continued work on the impress annotation feature 2009-09-06 14:14:00 +0200 cl r275859 : #i103139# continued work on the impress annotation feature 2009-09-05 20:57:24 +0200 cl r275854 : #i103139# continued work on the impress annotation feature 2009-09-05 20:56:29 +0200 cl r275853 : #i103139# continued work on the impress annotation feature 2009-09-05 20:55:27 +0200 cl r275852 : #i103139# continued work on the impress annotation feature 2009-09-05 20:11:42 +0200 cl r275851 : #i103139# continued work on the impress annotation feature 2009-09-05 20:11:09 +0200 cl r275850 : #i103139# continued work on the impress annotation feature 2009-09-05 17:43:33 +0200 cl r275845 : #i103139# continued work on the impress annotation feature 2009-09-05 17:04:41 +0200 cl r275843 : #i103139# continued work on the impress annotation feature 2009-09-05 17:03:26 +0200 cl r275842 : #i103139# continued work on the impress annotation feature 2009-09-05 17:02:53 +0200 cl r275841 : #i103139# continued work on the impress annotation feature 2009-09-05 13:15:04 +0200 pl r275839 : #i104823# WB_NEEDSFOCUS 2009-09-05 13:14:41 +0200 pl r275838 : #i104823# WB_NEEDSFOCUS 2009-09-04 17:48:21 +0200 cl r275826 : #i103139# continued work on the impress annotation feature 2009-09-04 17:35:03 +0200 cl r275825 : #i103139# continued work on the impress annotation feature 2009-09-04 17:15:46 +0200 cl r275824 : #i103139# continued work on the impress annotation feature 2009-09-04 17:12:54 +0200 cl r275823 : #i103139# continued work on the impress annotation feature 2009-09-04 17:05:23 +0200 cl r275822 : #i103139# continued work on the impress annotation feature 2009-09-04 16:48:28 +0200 cl r275820 : #i103139# continued work on the impress annotation feature 2009-09-04 16:44:02 +0200 cl r275818 : #i103139# continued work on the impress annotation feature 2009-09-04 16:43:23 +0200 cl r275817 : #i103139# continued work on the impress annotation feature 2009-09-04 16:06:04 +0200 cl r275812 : #i103139# continued work on the impress annotation feature 2009-09-04 16:05:45 +0200 cl r275811 : #i103139# continued work on the impress annotation feature 2009-09-04 15:04:33 +0200 cl r275806 : #i103139# continued work on the impress annotation feature 2009-09-04 11:43:14 +0200 cl r275795 : #i103139# continued work on the impress annotation feature 2009-09-04 11:27:10 +0200 cl r275793 : #i103139# continued work on the impress annotation feature 2009-09-04 11:10:02 +0200 cl r275792 : #i103139# continued work on the impress annotation feature 2009-09-04 11:07:05 +0200 cl r275790 : #i103139# continued work on the impress annotation feature 2009-09-04 11:05:01 +0200 cl r275789 : #i103139# continued work on the impress annotation feature 2009-09-04 10:55:51 +0200 cl r275785 : #i103139# renamed notes to comments 2009-09-04 10:54:57 +0200 cl r275784 : #i103139# renamed notes to comments 2009-09-03 20:37:35 +0200 cl r275772 : #i103139# continued work on the impress annotation feature 2009-09-03 20:35:31 +0200 cl r275771 : #i103139# continued work on the impress annotation feature 2009-09-01 18:17:55 +0200 cl r275680 : #i103139# continued work on the impress annotation feature 2009-09-01 18:15:08 +0200 cl r275678 : #i103139# continued work on the impress annotation feature 2009-09-01 18:13:38 +0200 cl r275677 : #i103139# continued work on the impress annotation feature 2009-08-18 12:35:42 +0200 cl r275089 : fixed merge error 2009-08-18 11:39:58 +0200 cl r275086 : CWS-TOOLING: rebase CWS impressnotes01 to trunk@275001 (milestone: DEV300:m55) 2009-07-30 13:45:10 +0200 cl r274481 : fixed merge errrors 2009-07-30 13:41:21 +0200 cl r274480 : fixed merge errrors 2009-07-30 13:39:40 +0200 cl r274478 : fixed merge errrors 2009-07-22 18:07:30 +0200 cl r274256 : CWS-TOOLING: rebase CWS impressnotes01 to trunk@273858 (milestone: DEV300:m52) 2009-07-21 17:21:31 +0200 cl r274208 : merging 2009-07-20 14:28:34 +0200 cl r274137 : #i103139# annotation support for impress 2009-07-20 14:28:04 +0200 cl r274136 : #i103139# annotation support for impress 2009-07-20 14:27:20 +0200 cl r274135 : #i103139# annotation support for impress 2009-07-20 14:21:17 +0200 cl r274134 : #i103139# annotation support for impress 2009-07-20 14:20:56 +0200 cl r274133 : #i103139# annotation support for impress 2009-07-20 14:20:09 +0200 cl r274132 : #i103139# annotation support for impress 2009-07-20 14:19:00 +0200 cl r274131 : #i103139# annotation support for impress 2009-07-20 14:17:50 +0200 cl r274130 : #i103139# annotation support for impress 2009-07-20 14:12:24 +0200 cl r274129 : #i103139# annotation support for impress 2009-07-20 13:52:03 +0200 cl r274128 : #i103139# annotation support for impress 2009-07-20 13:51:11 +0200 cl r274127 : #i103139# annotation support for impress 2009-07-20 13:48:59 +0200 cl r274126 : #i103139# annotation support for impress 2009-07-20 13:43:56 +0200 cl r274125 : #i103139# annotation support for impress 2009-07-20 13:31:55 +0200 cl r274123 : #i103139# annotation support for impress 2009-07-20 13:30:45 +0200 cl r274122 : #i103139# annotation support for impress --- sd/inc/drawdoc.hxx | 8 + sd/inc/glob.hrc | 5 +- sd/inc/glob.hxx | 1 + sd/inc/helpids.h | 2 + sd/inc/sdpage.hxx | 11 + sd/inc/textapi.hxx | 69 ++ sd/prj/build.lst | 5 +- sd/sdi/TaskPaneViewShell.sdi | 1 + sd/sdi/drviewsh.sdi | 44 + sd/sdi/grviewsh.sdi | 40 + sd/source/core/annotations/Annotation.cxx | 448 +++++++ sd/source/core/annotations/AnnotationAccess.cxx | 59 + .../core/annotations/AnnotationEnumeration.cxx | 96 ++ sd/source/core/annotations/makefile.mk | 53 + sd/source/core/drawdoc.cxx | 37 +- sd/source/core/sdpage2.cxx | 63 + sd/source/core/text/makefile.mk | 52 + sd/source/core/text/textapi.cxx | 325 +++++ sd/source/filter/eppt/eppt.cxx | 154 ++- sd/source/filter/eppt/eppt.hxx | 4 +- sd/source/filter/eppt/epptdef.hxx | 3 + sd/source/filter/eppt/epptso.cxx | 24 +- sd/source/ui/annotations/annotationmanager.cxx | 1264 ++++++++++++++++++++ sd/source/ui/annotations/annotationmanagerimpl.hxx | 144 +++ sd/source/ui/annotations/annotations.hrc | 68 ++ sd/source/ui/annotations/annotations.src | 212 ++++ sd/source/ui/annotations/annotationtag.cxx | 792 ++++++++++++ sd/source/ui/annotations/annotationtag.hxx | 110 ++ sd/source/ui/annotations/annotationwindow.cxx | 849 +++++++++++++ sd/source/ui/annotations/annotationwindow.hxx | 180 +++ sd/source/ui/annotations/makefile.mk | 60 + sd/source/ui/app/optsitem.cxx | 57 +- sd/source/ui/app/res_bmp.src | 8 + sd/source/ui/app/strings.src | 6 +- .../configuration/ConfigurationController.cxx | 2 +- .../configuration/ConfigurationUpdater.cxx | 2 +- sd/source/ui/func/fupoor.cxx | 5 + sd/source/ui/func/smarttag.cxx | 81 +- sd/source/ui/inc/DrawViewShell.hxx | 7 +- sd/source/ui/inc/annotationmanager.hxx | 62 + sd/source/ui/inc/optsitem.hxx | 5 + sd/source/ui/inc/res_bmp.hrc | 3 + sd/source/ui/inc/smarttag.hxx | 12 + sd/source/ui/slidesorter/view/SlideSorterView.cxx | 2 - .../view/SlsPageObjectViewObjectContact.cxx | 34 +- sd/source/ui/toolpanel/TaskPaneShellManager.cxx | 12 +- sd/source/ui/toolpanel/TaskPaneViewShell.cxx | 1 - sd/source/ui/toolpanel/controls/makefile.mk | 1 - sd/source/ui/unoidl/unomodel.cxx | 11 + sd/source/ui/unoidl/unoobj.cxx | 3 + sd/source/ui/unoidl/unopage.cxx | 37 +- sd/source/ui/unoidl/unopage.hxx | 8 + sd/source/ui/view/drviews1.cxx | 2 + sd/source/ui/view/drviews4.cxx | 3 + sd/source/ui/view/drviewsa.cxx | 43 +- sd/source/ui/view/viewshe2.cxx | 5 +- sd/source/ui/view/viewshel.cxx | 13 +- sd/uiconfig/sdraw/accelerator/de/default.xml | 63 - sd/uiconfig/sdraw/accelerator/en-GB/default.xml | 63 - sd/uiconfig/sdraw/accelerator/en-US/default.xml | 63 - sd/uiconfig/sdraw/accelerator/es/default.xml | 63 - sd/uiconfig/sdraw/accelerator/fr/default.xml | 63 - sd/uiconfig/sdraw/menubar/menubar.xml | 8 +- sd/uiconfig/sdraw/toolbar/commentsbar.xml | 11 + sd/uiconfig/simpress/accelerator/de/default.xml | 11 - sd/uiconfig/simpress/accelerator/default.xml | 71 -- sd/uiconfig/simpress/accelerator/es/default.xml | 9 - sd/uiconfig/simpress/accelerator/fr/default.xml | 4 - sd/uiconfig/simpress/menubar/menubar.xml | 8 +- sd/uiconfig/simpress/toolbar/commentsbar.xml | 11 + sd/util/hidother.src | 3 + sd/util/makefile.mk | 4 + 72 files changed, 5562 insertions(+), 501 deletions(-) create mode 100644 sd/inc/textapi.hxx create mode 100644 sd/source/core/annotations/Annotation.cxx create mode 100644 sd/source/core/annotations/AnnotationAccess.cxx create mode 100644 sd/source/core/annotations/AnnotationEnumeration.cxx create mode 100644 sd/source/core/annotations/makefile.mk create mode 100644 sd/source/core/text/makefile.mk create mode 100644 sd/source/core/text/textapi.cxx create mode 100644 sd/source/ui/annotations/annotationmanager.cxx create mode 100755 sd/source/ui/annotations/annotationmanagerimpl.hxx create mode 100644 sd/source/ui/annotations/annotations.hrc create mode 100644 sd/source/ui/annotations/annotations.src create mode 100644 sd/source/ui/annotations/annotationtag.cxx create mode 100644 sd/source/ui/annotations/annotationtag.hxx create mode 100644 sd/source/ui/annotations/annotationwindow.cxx create mode 100644 sd/source/ui/annotations/annotationwindow.hxx create mode 100644 sd/source/ui/annotations/makefile.mk create mode 100755 sd/source/ui/inc/annotationmanager.hxx delete mode 100644 sd/uiconfig/sdraw/accelerator/de/default.xml delete mode 100644 sd/uiconfig/sdraw/accelerator/en-GB/default.xml delete mode 100644 sd/uiconfig/sdraw/accelerator/en-US/default.xml delete mode 100644 sd/uiconfig/sdraw/accelerator/es/default.xml delete mode 100644 sd/uiconfig/sdraw/accelerator/fr/default.xml create mode 100644 sd/uiconfig/sdraw/toolbar/commentsbar.xml delete mode 100644 sd/uiconfig/simpress/accelerator/de/default.xml delete mode 100644 sd/uiconfig/simpress/accelerator/default.xml delete mode 100644 sd/uiconfig/simpress/accelerator/es/default.xml delete mode 100644 sd/uiconfig/simpress/accelerator/fr/default.xml create mode 100644 sd/uiconfig/simpress/toolbar/commentsbar.xml (limited to 'sd/sdi') diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx index 4b5a17c3e20d..975722604df9 100644 --- a/sd/inc/drawdoc.hxx +++ b/sd/inc/drawdoc.hxx @@ -47,6 +47,8 @@ // #107844# #include +#include + #ifndef INCLUDED_MEMORY #include #define INCLUDED_MEMORY @@ -209,6 +211,8 @@ private: DECL_LINK(OnlineSpellingHdl, Timer*); DECL_LINK(OnlineSpellEventHdl, EditStatus*); + std::vector< rtl::OUString > maAnnotationAuthors; + protected: virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel(); @@ -591,6 +595,10 @@ public: void UpdatePageRelativeURLs(const String& rOldName, const String& rNewName); + void SetCalcFieldValueHdl( ::Outliner* pOutliner); + + sal_uInt16 GetAnnotationAuthorIndex( const rtl::OUString& rAuthor ); + private: /** This member stores the printer independent layout mode. Please refer to SetPrinterIndependentLayout() for its diff --git a/sd/inc/glob.hrc b/sd/inc/glob.hrc index c662cfb0e0a5..7ef9ecad779c 100644 --- a/sd/inc/glob.hrc +++ b/sd/inc/glob.hrc @@ -143,7 +143,9 @@ #define STR_RIGHT_PANE_SHELL RID_GLOB_START+115 #define RID_CUSTOMANIMATION_START RID_GLOB_START+120 -#define RID_CUSTOMANIMATION_END RID_GLOB_START+220 +#define RID_CUSTOMANIMATION_END RID_GLOB_START+199 +#define RID_ANNOTATIONS_START RID_GLOB_START+200 +#define RID_ANNOTATIONS_END RID_GLOB_START+220 #define STR_UNDO_ANIMATION RID_GLOB_START+221 #define STR_UNDO_SLIDE_PARAMS RID_GLOB_START+222 #define RID_SLIDESHOW_CONTEXTMENU RID_GLOB_START+223 @@ -153,3 +155,4 @@ #define RID_TABPAGE_PARA_NUMBERING RID_GLOB_START+226 + diff --git a/sd/inc/glob.hxx b/sd/inc/glob.hxx index 5ab2253253db..ea9f22d209c5 100644 --- a/sd/inc/glob.hxx +++ b/sd/inc/glob.hxx @@ -68,6 +68,7 @@ #define SD_IF_SDLEFTDRAWPANESHELL SFX_INTERFACE_SD_START + 25 #define SD_IF_SDRIGHTPANESHELL SFX_INTERFACE_SD_START + 26 #define SD_IF_SDDRAWTABLEOBJECTBAR SFX_INTERFACE_SD_START + 27 +#define SD_IF_SDANNOTATIONSHELL SFX_INTERFACE_SD_START + 28 // Inventor-Id fuer StarDraw UserData const UINT32 SdUDInventor=UINT32('S')*0x00000001+ diff --git a/sd/inc/helpids.h b/sd/inc/helpids.h index 69a3c6fe901d..e094027f9417 100644 --- a/sd/inc/helpids.h +++ b/sd/inc/helpids.h @@ -280,3 +280,5 @@ #define HID_SD_CELL_STYLE_LAST_COLUMN (HID_SD_START + 199) #define HID_SD_TABLE_DESIGN (HID_SD_START + 200) +#define HID_SD_ANNOTATIONS (HID_SD_START + 201) + diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx index 8bbabcb57593..842c70d50fd3 100644 --- a/sd/inc/sdpage.hxx +++ b/sd/inc/sdpage.hxx @@ -41,6 +41,7 @@ #endif #include #include +#include #include #include @@ -105,6 +106,8 @@ namespace sd { bool operator==( const HeaderFooterSettings& rSettings ) const; }; + + typedef std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > > AnnotationVector; } namespace sd { @@ -149,6 +152,8 @@ protected: Orientation meOrientation; // Print-Orientation SdPageLink* mpPageLink; // PageLink (nur bei gelinkten Seiten) + sd::AnnotationVector maAnnotations; + /** holds the smil animation sequences for this page */ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxAnimationNode; @@ -391,6 +396,12 @@ public: */ bool IsPrecious (void) const; + void createAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation ); + void addAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, int nIndex = -1 ); + void removeAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation ); + const sd::AnnotationVector& getAnnotations() const { return maAnnotations; } + bool hasAnnotations() const { return !maAnnotations.empty(); } + private: bool mbIsPrecious; diff --git a/sd/inc/textapi.hxx b/sd/inc/textapi.hxx new file mode 100644 index 000000000000..5b339ab6054d --- /dev/null +++ b/sd/inc/textapi.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: textapi.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SD_TEXTAPI_HXX_ +#define _SD_TEXTAPI_HXX_ + +#include +#include +#include +#include + +class SdDrawDocument; + +namespace sd { + +class TextAPIEditSource; + +class TextApiObject : public SvxUnoText +{ +public: + static rtl::Reference< TextApiObject > create( SdDrawDocument* pDoc ); + + virtual ~TextApiObject() throw(); + + virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); + + OutlinerParaObject* CreateText(); + void SetString( const String& rText ); + void SetText( OutlinerParaObject& rText ); + String GetText(); + + static TextApiObject* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& ); + +private: + TextAPIEditSource* mpSource; + TextApiObject( TextAPIEditSource* pEditSource ); +}; + +} // namespace sd + + +#endif // _SD_TEXTAPI_HXX_ diff --git a/sd/prj/build.lst b/sd/prj/build.lst index 40e6ed16ebee..ace6165f64f3 100644 --- a/sd/prj/build.lst +++ b/sd/prj/build.lst @@ -13,6 +13,8 @@ sd sd\source\ui\app nmake - all sd_app sd_sdi sd_inc NULL sd sd\source\ui\dlg nmake - all sd_dlg sd_sdi sd_inc NULL sd sd\source\core nmake - all sd_core sd_sdi sd_inc NULL sd sd\source\core\undo nmake - all sd_undo sd_core sd_inc NULL +sd sd\source\core\text nmake - all sd_text sd_inc NULL +sd sd\source\core\annotations nmake - all sd_annotations sd_inc NULL sd sd\source\ui\docshell nmake - all sd_docsh sd_sdi sd_inc NULL sd sd\source\ui\unoidl nmake - all sd_unid sd_sdi sd_inc NULL sd sd\source\ui\accessibility nmake - all sd_accessibility sd_inc NULL @@ -40,4 +42,5 @@ sd sd\source\ui\framework\configuration nmake - all sd_framework_configuration s sd sd\source\ui\framework\module nmake - all sd_framework_module sd_inc NULL sd sd\source\ui\framework\factories nmake - all sd_framework_factories sd_inc NULL sd sd\source\ui\framework\tools nmake - all sd_framework_tools sd_inc NULL -sd sd\util nmake - all sd_util sd_app sd_cgm sd_core sd_dlg sd_docsh sd_eppt sd_filt sd_func sd_grf sd_unid sd_view sd_xml sd_html sd_ppt sd_accessibility sd_animations sd_toolpanel sd_toolpanel_controls sd_tools sd_slsshell sd_slsmodel sd_slsview sd_slscontroller sd_slscache sd_notes sd_table sd_slideshow sd_presenter sd_undo sd_helper sd_framework_configuration sd_framework_module sd_framework_tools sd_framework_factories NULL +sd sd\source\ui\annotations nmake - all sd_uiannotations sd_inc NULL +sd sd\util nmake - all sd_util sd_app sd_cgm sd_core sd_dlg sd_docsh sd_eppt sd_filt sd_func sd_grf sd_unid sd_view sd_xml sd_html sd_ppt sd_accessibility sd_animations sd_toolpanel sd_toolpanel_controls sd_tools sd_slsshell sd_slsmodel sd_slsview sd_slscontroller sd_slscache sd_notes sd_table sd_slideshow sd_presenter sd_undo sd_helper sd_framework_configuration sd_framework_module sd_framework_tools sd_framework_factories sd_text sd_annotations sd_uiannotations NULL diff --git a/sd/sdi/TaskPaneViewShell.sdi b/sd/sdi/TaskPaneViewShell.sdi index ede307b955bf..8d35e88155c4 100644 --- a/sd/sdi/TaskPaneViewShell.sdi +++ b/sd/sdi/TaskPaneViewShell.sdi @@ -308,3 +308,4 @@ shell LayoutMenu shell TaskPaneViewShell { } + diff --git a/sd/sdi/drviewsh.sdi b/sd/sdi/drviewsh.sdi index a41ed20e4ddd..59f493703e74 100644 --- a/sd/sdi/drviewsh.sdi +++ b/sd/sdi/drviewsh.sdi @@ -181,10 +181,54 @@ interface ImpressEditView : DrawView StateMethod = GetMenuState ; ] } +interface Annotation +{ + SID_INSERT_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] + SID_SHOW_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] + SID_REPLYTO_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] + SID_DELETE_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] + SID_DELETEALL_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] + SID_PREVIOUS_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] + SID_NEXT_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] + SID_DELETEALLBYAUTHOR_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] +} shell DrawViewShell { import ImpressEditView[Automation]; + import Annotation; } diff --git a/sd/sdi/grviewsh.sdi b/sd/sdi/grviewsh.sdi index 12245e6584dc..055f762aa314 100644 --- a/sd/sdi/grviewsh.sdi +++ b/sd/sdi/grviewsh.sdi @@ -50,4 +50,44 @@ interface GraphicEditView : DrawView shell GraphicViewShell { import GraphicEditView[Automation]; + SID_INSERT_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] + SID_SHOW_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] + SID_REPLYTO_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] + SID_DELETE_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] + SID_DELETEALL_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] + SID_PREVIOUS_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] + SID_NEXT_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] + SID_DELETEALLBYAUTHOR_POSTIT + [ + ExecMethod = ExecuteAnnotation; + StateMethod = GetAnnotationState; + ] } diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx new file mode 100644 index 000000000000..174c548f222e --- /dev/null +++ b/sd/source/core/annotations/Annotation.cxx @@ -0,0 +1,448 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: unopage.cxx,v $ + * $Revision: 1.96 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include "osl/time.h" +#include "sal/config.h" + +#include +#include +#include + +#include +#include +#include +#include + +#include "drawdoc.hxx" +#include "sdpage.hxx" +#include "textapi.hxx" + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::office; +using namespace ::com::sun::star::drawing; +using namespace ::com::sun::star::geometry; +using namespace ::com::sun::star::text; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star; + +extern void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName, const Reference< XInterface >& xSource ); + +namespace sd { + +class Annotation : private ::cppu::BaseMutex, + public ::cppu::WeakComponentImplHelper1< XAnnotation>, + public ::cppu::PropertySetMixin< XAnnotation > +{ +public: + explicit Annotation( const Reference< XComponentContext >& context, SdPage* pPage ); + + SdPage* GetPage() const { return mpPage; } + SdrModel* GetModel() { return (mpPage != 0) ? mpPage->GetModel() : 0; } + + // XInterface: + virtual Any SAL_CALL queryInterface(Type const & type) throw (RuntimeException); + virtual void SAL_CALL acquire() throw () { ::cppu::WeakComponentImplHelper1< XAnnotation >::acquire(); } + virtual void SAL_CALL release() throw () { ::cppu::WeakComponentImplHelper1< XAnnotation >::release(); } + + // ::com::sun::star::beans::XPropertySet: + virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (RuntimeException); + virtual void SAL_CALL setPropertyValue(const OUString & aPropertyName, const Any & aValue) throw (RuntimeException, UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException); + virtual Any SAL_CALL getPropertyValue(const OUString & PropertyName) throw (RuntimeException, UnknownPropertyException, WrappedTargetException); + virtual void SAL_CALL addPropertyChangeListener(const OUString & aPropertyName, const Reference< XPropertyChangeListener > & xListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException); + virtual void SAL_CALL removePropertyChangeListener(const OUString & aPropertyName, const Reference< XPropertyChangeListener > & aListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException); + virtual void SAL_CALL addVetoableChangeListener(const OUString & PropertyName, const Reference< XVetoableChangeListener > & aListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException); + virtual void SAL_CALL removeVetoableChangeListener(const OUString & PropertyName, const Reference< XVetoableChangeListener > & aListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException); + + // ::com::sun::star::office::XAnnotation: + virtual ::com::sun::star::uno::Any SAL_CALL getAnchor() throw (::com::sun::star::uno::RuntimeException); + virtual RealPoint2D SAL_CALL getPosition() throw (RuntimeException); + virtual void SAL_CALL setPosition(const RealPoint2D & the_value) throw (RuntimeException); + virtual ::com::sun::star::geometry::RealSize2D SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSize( const ::com::sun::star::geometry::RealSize2D& _size ) throw (::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getAuthor() throw (RuntimeException); + virtual void SAL_CALL setAuthor(const OUString & the_value) throw (RuntimeException); + virtual util::DateTime SAL_CALL getDateTime() throw (RuntimeException); + virtual void SAL_CALL setDateTime(const util::DateTime & the_value) throw (RuntimeException); + virtual Reference< XText > SAL_CALL getTextRange() throw (RuntimeException); + +private: + Annotation(const Annotation &); // not defined + Annotation& operator=(const Annotation &); // not defined + + // destructor is private and will be called indirectly by the release call virtual ~Annotation() {} + + void createChangeUndo(); + + // overload WeakComponentImplHelperBase::disposing() + // This function is called upon disposing the component, + // if your component needs special work when it becomes + // disposed, do it here. + virtual void SAL_CALL disposing(); + + SdPage* mpPage; + Reference< XComponentContext > m_xContext; + mutable ::osl::Mutex m_aMutex; + RealPoint2D m_Position; + RealSize2D m_Size; + OUString m_Author; + util::DateTime m_DateTime; + rtl::Reference< TextApiObject > m_TextRange; +}; + +class UndoInsertOrRemoveAnnotation : public SdrUndoAction +{ +public: + UndoInsertOrRemoveAnnotation( Annotation& rAnnotation, bool bInsert ); + + virtual void Undo(); + virtual void Redo(); + +protected: + rtl::Reference< Annotation > mxAnnotation; + bool mbInsert; + int mnIndex; +}; + +struct AnnotationData +{ + RealPoint2D m_Position; + RealSize2D m_Size; + OUString m_Author; + util::DateTime m_DateTime; + + void get( const rtl::Reference< Annotation >& xAnnotation ) + { + m_Position = xAnnotation->getPosition(); + m_Size = xAnnotation->getSize(); + m_Author = xAnnotation->getAuthor(); + m_DateTime = xAnnotation->getDateTime(); + } + + void set( const rtl::Reference< Annotation >& xAnnotation ) + { + xAnnotation->setPosition(m_Position); + xAnnotation->setSize(m_Size); + xAnnotation->setAuthor(m_Author); + xAnnotation->setDateTime(m_DateTime); + } +}; + +class UndoAnnotation : public SdrUndoAction +{ +public: + UndoAnnotation( Annotation& rAnnotation ); + + virtual void Undo(); + virtual void Redo(); + +protected: + rtl::Reference< Annotation > mxAnnotation; + AnnotationData maUndoData; + AnnotationData maRedoData; +}; + +void createAnnotation( Reference< XAnnotation >& xAnnotation, SdPage* pPage ) +{ + Reference xContext (comphelper_getProcessComponentContext()); + xAnnotation.set( new Annotation(xContext, pPage) ); + pPage->addAnnotation(xAnnotation); +} + +Annotation::Annotation( const Reference< XComponentContext >& context, SdPage* pPage ) +: ::cppu::WeakComponentImplHelper1< XAnnotation >(m_aMutex) +, ::cppu::PropertySetMixin< XAnnotation >(context, static_cast< Implements >(IMPLEMENTS_PROPERTY_SET), Sequence< ::rtl::OUString >()) +, mpPage( pPage ) +{ +} + +// overload WeakComponentImplHelperBase::disposing() +// This function is called upon disposing the component, +// if your component needs special work when it becomes +// disposed, do it here. +void SAL_CALL Annotation::disposing() +{ + mpPage = 0; + if( m_TextRange.is() ) + { + m_TextRange->dispose(); + m_TextRange.clear(); + } +} + +Any Annotation::queryInterface(Type const & type) throw (RuntimeException) +{ + return ::cppu::WeakComponentImplHelper1< XAnnotation>::queryInterface(type); +} + +// com.sun.star.beans.XPropertySet: +Reference< XPropertySetInfo > SAL_CALL Annotation::getPropertySetInfo() throw (RuntimeException) +{ + return ::cppu::PropertySetMixin< XAnnotation >::getPropertySetInfo(); +} + +void SAL_CALL Annotation::setPropertyValue(const OUString & aPropertyName, const Any & aValue) throw (RuntimeException, UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException) +{ + ::cppu::PropertySetMixin< XAnnotation >::setPropertyValue(aPropertyName, aValue); +} + +Any SAL_CALL Annotation::getPropertyValue(const OUString & aPropertyName) throw (RuntimeException, UnknownPropertyException, WrappedTargetException) +{ + return ::cppu::PropertySetMixin< XAnnotation >::getPropertyValue(aPropertyName); +} + +void SAL_CALL Annotation::addPropertyChangeListener(const OUString & aPropertyName, const Reference< XPropertyChangeListener > & xListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException) +{ + ::cppu::PropertySetMixin< XAnnotation >::addPropertyChangeListener(aPropertyName, xListener); +} + +void SAL_CALL Annotation::removePropertyChangeListener(const OUString & aPropertyName, const Reference< XPropertyChangeListener > & xListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException) +{ + ::cppu::PropertySetMixin< XAnnotation >::removePropertyChangeListener(aPropertyName, xListener); +} + +void SAL_CALL Annotation::addVetoableChangeListener(const OUString & aPropertyName, const Reference< XVetoableChangeListener > & xListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException) +{ + ::cppu::PropertySetMixin< XAnnotation >::addVetoableChangeListener(aPropertyName, xListener); +} + +void SAL_CALL Annotation::removeVetoableChangeListener(const OUString & aPropertyName, const Reference< XVetoableChangeListener > & xListener) throw (RuntimeException, UnknownPropertyException, WrappedTargetException) +{ + ::cppu::PropertySetMixin< XAnnotation >::removeVetoableChangeListener(aPropertyName, xListener); +} + +Any SAL_CALL Annotation::getAnchor() throw (RuntimeException) +{ + osl::MutexGuard g(m_aMutex); + Any aRet; + if( mpPage ) + { + Reference< XDrawPage > xPage( mpPage->getUnoPage(), UNO_QUERY ); + aRet <<= xPage; + } + return aRet; +} + +// ::com::sun::star::office::XAnnotation: +RealPoint2D SAL_CALL Annotation::getPosition() throw (RuntimeException) +{ + osl::MutexGuard g(m_aMutex); + return m_Position; +} + +void SAL_CALL Annotation::setPosition(const RealPoint2D & the_value) throw (RuntimeException) +{ + prepareSet( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Position")), + Any(), Any(), 0); + { + osl::MutexGuard g(m_aMutex); + createChangeUndo(); + m_Position = the_value; + } +} + +// ::com::sun::star::office::XAnnotation: +RealSize2D SAL_CALL Annotation::getSize() throw (RuntimeException) +{ + osl::MutexGuard g(m_aMutex); + return m_Size; +} + +void SAL_CALL Annotation::setSize(const RealSize2D & the_value) throw (RuntimeException) +{ + prepareSet( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Size")), + Any(), Any(), 0); + { + osl::MutexGuard g(m_aMutex); + createChangeUndo(); + m_Size = the_value; + } +} + +OUString SAL_CALL Annotation::getAuthor() throw (RuntimeException) +{ + osl::MutexGuard g(m_aMutex); + return m_Author; +} + +void SAL_CALL Annotation::setAuthor(const OUString & the_value) throw (RuntimeException) +{ + prepareSet( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Author")), + Any(), Any(), 0); + { + osl::MutexGuard g(m_aMutex); + createChangeUndo(); + m_Author = the_value; + } +} + +util::DateTime SAL_CALL Annotation::getDateTime() throw (RuntimeException) +{ + osl::MutexGuard g(m_aMutex); + return m_DateTime; +} + +void SAL_CALL Annotation::setDateTime(const util::DateTime & the_value) throw (RuntimeException) +{ + prepareSet( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DateTime")), + Any(), Any(), 0); + { + osl::MutexGuard g(m_aMutex); + createChangeUndo(); + m_DateTime = the_value; + } +} + +void Annotation::createChangeUndo() +{ + SdrModel* pModel = GetModel(); + if( pModel && pModel->IsUndoEnabled() ) + pModel->AddUndo( new UndoAnnotation( *this ) ); + + if( pModel ) + { + pModel->SetChanged(); + Reference< XInterface > xSource( static_cast( this ) ); + NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), OUString( RTL_CONSTASCII_USTRINGPARAM("OnAnnotationChanged") ), xSource ); + } +} + +Reference< XText > SAL_CALL Annotation::getTextRange() throw (RuntimeException) +{ + osl::MutexGuard g(m_aMutex); + if( !m_TextRange.is() && (mpPage != 0) ) + { + m_TextRange = TextApiObject::create( static_cast< SdDrawDocument* >( mpPage->GetModel() ) ); + } + return Reference< XText >( m_TextRange.get() ); +} + +SdrUndoAction* CreateUndoInsertOrRemoveAnnotation( const Reference< XAnnotation >& xAnnotation, bool bInsert ) +{ + Annotation* pAnnotation = dynamic_cast< Annotation* >( xAnnotation.get() ); + if( pAnnotation ) + { + return new UndoInsertOrRemoveAnnotation( *pAnnotation, bInsert ); + } + else + { + return 0; + } +} + +UndoInsertOrRemoveAnnotation::UndoInsertOrRemoveAnnotation( Annotation& rAnnotation, bool bInsert ) +: SdrUndoAction( *rAnnotation.GetModel() ) +, mxAnnotation( &rAnnotation ) +, mbInsert( bInsert ) +, mnIndex( 0 ) +{ + SdPage* pPage = rAnnotation.GetPage(); + if( pPage ) + { + Reference< XAnnotation > xAnnotation( &rAnnotation ); + + const AnnotationVector& rVec = pPage->getAnnotations(); + for( AnnotationVector::const_iterator iter = rVec.begin(); iter != rVec.end(); iter++ ) + { + if( (*iter) == xAnnotation ) + break; + + mnIndex++; + } + } +} + +void UndoInsertOrRemoveAnnotation::Undo() +{ + SdPage* pPage = mxAnnotation->GetPage(); + SdrModel* pModel = mxAnnotation->GetModel(); + if( pPage && pModel ) + { + Reference< XAnnotation > xAnnotation( mxAnnotation.get() ); + if( mbInsert ) + { + pPage->removeAnnotation( xAnnotation ); + } + else + { + pPage->addAnnotation( xAnnotation, mnIndex ); + } + } +} + +void UndoInsertOrRemoveAnnotation::Redo() +{ + SdPage* pPage = mxAnnotation->GetPage(); + SdrModel* pModel = mxAnnotation->GetModel(); + if( pPage && pModel ) + { + Reference< XAnnotation > xAnnotation( mxAnnotation.get() ); + + if( mbInsert ) + { + pPage->addAnnotation( xAnnotation, mnIndex ); + } + else + { + pPage->removeAnnotation( xAnnotation ); + } + } +} + +UndoAnnotation::UndoAnnotation( Annotation& rAnnotation ) +: SdrUndoAction( *rAnnotation.GetModel() ) +, mxAnnotation( &rAnnotation ) +{ + maUndoData.get( mxAnnotation ); +} + +void UndoAnnotation::Undo() +{ + maRedoData.get( mxAnnotation ); + maUndoData.set( mxAnnotation ); +} + +void UndoAnnotation::Redo() +{ + maUndoData.get( mxAnnotation ); + maRedoData.set( mxAnnotation ); +} + +} // namespace sd + diff --git a/sd/source/core/annotations/AnnotationAccess.cxx b/sd/source/core/annotations/AnnotationAccess.cxx new file mode 100644 index 000000000000..ffcca97962e8 --- /dev/null +++ b/sd/source/core/annotations/AnnotationAccess.cxx @@ -0,0 +1,59 @@ +#include "sal/config.h" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "cppuhelper/implbase1.hxx" +#include "com/sun/star/office/XAnnotationAccess.hpp" + +namespace css = ::com::sun::star; + +class AnnotationAccess: + public ::cppu::WeakImplHelper1< + css::office::XAnnotationAccess> +{ +public: + explicit AnnotationAccess(css::uno::Reference< css::uno::XComponentContext > const & context); + + // ::com::sun::star::office::XAnnotationAccess: + virtual css::uno::Reference< css::office::XAnnotation > SAL_CALL createAndInsertAnnotation() throw (css::uno::RuntimeException); + virtual void SAL_CALL removeAnnotation(const css::uno::Reference< css::office::XAnnotation > & annotation) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException); + virtual css::uno::Reference< css::office::XAnnotationEnumeration > SAL_CALL createAnnotationEnumeration() throw (css::uno::RuntimeException); + +private: + AnnotationAccess(const AnnotationAccess &); // not defined + AnnotationAccess& operator=(const AnnotationAccess &); // not defined + + // destructor is private and will be called indirectly by the release call virtual ~AnnotationAccess() {} + + css::uno::Reference< css::uno::XComponentContext > m_xContext; +}; + +AnnotationAccess::AnnotationAccess(css::uno::Reference< css::uno::XComponentContext > const & context) : + m_xContext(context) +{} + +// ::com::sun::star::office::XAnnotationAccess: +css::uno::Reference< css::office::XAnnotation > SAL_CALL AnnotationAccess::createAndInsertAnnotation() throw (css::uno::RuntimeException) +{ + // TODO: Exchange the default return implementation for "createAndInsertAnnotation" !!! + // Exchange the default return implementation. + // NOTE: Default initialized polymorphic structs can cause problems because of + // missing default initialization of primitive types of some C++ compilers or + // different Any initialization in Java and C++ polymorphic structs. + return css::uno::Reference< css::office::XAnnotation >(); +} + +void SAL_CALL AnnotationAccess::removeAnnotation(const css::uno::Reference< css::office::XAnnotation > & annotation) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException) +{ + // TODO: Insert your implementation for "removeAnnotation" here. +} + +css::uno::Reference< css::office::XAnnotationEnumeration > SAL_CALL AnnotationAccess::createAnnotationEnumeration() throw (css::uno::RuntimeException) +{ + // TODO: Exchange the default return implementation for "createAnnotationEnumeration" !!! + // Exchange the default return implementation. + // NOTE: Default initialized polymorphic structs can cause problems because of + // missing default initialization of primitive types of some C++ compilers or + // different Any initialization in Java and C++ polymorphic structs. + return css::uno::Reference< css::office::XAnnotationEnumeration >(); +} + + diff --git a/sd/source/core/annotations/AnnotationEnumeration.cxx b/sd/source/core/annotations/AnnotationEnumeration.cxx new file mode 100644 index 000000000000..69947f3489db --- /dev/null +++ b/sd/source/core/annotations/AnnotationEnumeration.cxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: unopage.cxx,v $ + * $Revision: 1.96 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include "sal/config.h" + +#include "cppuhelper/implbase1.hxx" + +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/office/XAnnotationEnumeration.hpp" + +#include "sdpage.hxx" +namespace css = ::com::sun::star; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::office; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +namespace sd { + +class AnnotationEnumeration: public ::cppu::WeakImplHelper1< css::office::XAnnotationEnumeration > +{ +public: + AnnotationEnumeration( const AnnotationVector& rAnnotations ); + + // ::com::sun::star::office::XAnnotationEnumeration: + virtual ::sal_Bool SAL_CALL hasMoreElements() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::office::XAnnotation > SAL_CALL nextElement() throw (css::uno::RuntimeException, css::container::NoSuchElementException); + +private: + AnnotationEnumeration(const AnnotationEnumeration &); // not defined + AnnotationEnumeration& operator=(const AnnotationEnumeration &); // not defined + + // destructor is private and will be called indirectly by the release call virtual ~AnnotationEnumeration() {} + + AnnotationVector maAnnotations; + AnnotationVector::iterator maIter; +}; + +Reference< XAnnotationEnumeration > createAnnotationEnumeration( const sd::AnnotationVector& rAnnotations ) +{ + return new AnnotationEnumeration( rAnnotations ); +} + +AnnotationEnumeration::AnnotationEnumeration( const AnnotationVector& rAnnotations ) +: maAnnotations(rAnnotations) +{ + maIter = maAnnotations.begin(); +} + +// ::com::sun::star::office::XAnnotationEnumeration: +::sal_Bool SAL_CALL AnnotationEnumeration::hasMoreElements() throw (css::uno::RuntimeException) +{ + return maIter != maAnnotations.end() ? sal_True : sal_False; +} + +css::uno::Reference< css::office::XAnnotation > SAL_CALL AnnotationEnumeration::nextElement() throw (css::uno::RuntimeException, css::container::NoSuchElementException) +{ + if( maIter == maAnnotations.end() ) + throw css::container::NoSuchElementException(); + + return (*maIter++); +} + +} // namespace sd + diff --git a/sd/source/core/annotations/makefile.mk b/sd/source/core/annotations/makefile.mk new file mode 100644 index 000000000000..0cbf57e3fe45 --- /dev/null +++ b/sd/source/core/annotations/makefile.mk @@ -0,0 +1,53 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PROJECTPCH=sd +PROJECTPCHSOURCE=$(PRJ)$/util$/sd +PRJNAME=sd +TARGET=annotations +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = $(SLO)$/Annotation.obj \ + $(SLO)$/AnnotationEnumeration.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 564df7b594b7..8d9f46a6c4f7 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -41,6 +41,8 @@ #include #include +#include + #ifndef _OFA_MISCCFG_HXX #include #endif @@ -222,7 +224,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) // Vorlagen existieren. SdrOutliner& rOutliner = GetDrawOutliner(); rOutliner.SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool()); - rOutliner.SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl)); + SetCalcFieldValueHdl( &rOutliner ); // set linguistic options { @@ -315,7 +317,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) SfxItemSet aSet2( pHitTestOutliner->GetEmptyItemSet() ); pHitTestOutliner->SetStyleSheetPool( (SfxStyleSheetPool*)GetStyleSheetPool() ); - pHitTestOutliner->SetCalcFieldValueHdl( LINK(SD_MOD(), SdModule, CalcFieldValueHdl) ); + SetCalcFieldValueHdl( pHitTestOutliner ); try { @@ -1068,5 +1070,36 @@ void SdDrawDocument::MasterPageListChanged() mpMasterPageListWatcher->Invalidate(); } +void SdDrawDocument::SetCalcFieldValueHdl(::Outliner* pOutliner) +{ + pOutliner->SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl)); +} + +sal_uInt16 SdDrawDocument::GetAnnotationAuthorIndex( const rtl::OUString& rAuthor ) +{ + // force current user to have first color + if( maAnnotationAuthors.empty() ) + { + SvtUserOptions aUserOptions; + maAnnotationAuthors.push_back( aUserOptions.GetFullName() ); + } + + sal_uInt16 idx = 0; + for( std::vector< OUString >::iterator iter( maAnnotationAuthors.begin() ); iter != maAnnotationAuthors.end(); iter++ ) + { + if( (*iter) == rAuthor ) + { + break; + } + idx++; + } + + if( idx == maAnnotationAuthors.size() ) + { + maAnnotationAuthors.push_back( rAuthor ); + } + + return idx; +} // eof diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx index d0c38e16593c..3f03640c27fb 100644 --- a/sd/source/core/sdpage2.cxx +++ b/sd/source/core/sdpage2.cxx @@ -64,6 +64,10 @@ using namespace ::sd; using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::office; + +extern void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName, const Reference< XInterface >& xSource ); /************************************************************************* |* @@ -586,3 +590,62 @@ void SdPage::setTransitionDuration ( double fTranstionDuration ) mfTransitionDuration = fTranstionDuration; ActionChanged(); } + +namespace sd { +extern void createAnnotation( Reference< XAnnotation >& xAnnotation, SdPage* pPage ); +extern SdrUndoAction* CreateUndoInsertOrRemoveAnnotation( const Reference< XAnnotation >& xAnnotation, bool bInsert ); +} + +void SdPage::createAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation ) +{ + sd::createAnnotation( xAnnotation, this ); +} + +void SdPage::addAnnotation( const Reference< XAnnotation >& xAnnotation, int nIndex ) +{ + if( (nIndex == -1) || (nIndex > (int)maAnnotations.size()) ) + { + maAnnotations.push_back( xAnnotation ); + } + else + { + maAnnotations.insert( maAnnotations.begin() + nIndex, xAnnotation ); + } + + if( pModel && pModel->IsUndoEnabled() ) + { + SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, true ); + if( pAction ) + pModel->AddUndo( pAction ); + } + + SetChanged(); + + if( pModel ) + { + pModel->SetChanged(); + Reference< XInterface > xSource( xAnnotation, UNO_QUERY ); + NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAnnotationInserted" ) ), xSource ); + } +} + +void SdPage::removeAnnotation( const Reference< XAnnotation >& xAnnotation ) +{ + if( pModel && pModel->IsUndoEnabled() ) + { + SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, false ); + if( pAction ) + pModel->AddUndo( pAction ); + } + + AnnotationVector::iterator iter = std::find( maAnnotations.begin(), maAnnotations.end(), xAnnotation ); + if( iter != maAnnotations.end() ) + maAnnotations.erase( iter ); + + if( pModel ) + { + pModel->SetChanged(); + Reference< XInterface > xSource( xAnnotation, UNO_QUERY ); + NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAnnotationRemoved" ) ), xSource ); + } +} diff --git a/sd/source/core/text/makefile.mk b/sd/source/core/text/makefile.mk new file mode 100644 index 000000000000..83ad7f619ce0 --- /dev/null +++ b/sd/source/core/text/makefile.mk @@ -0,0 +1,52 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PROJECTPCH=sd +PROJECTPCHSOURCE=$(PRJ)$/util$/sd +PRJNAME=sd +TARGET=text +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = $(SLO)$/textapi.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/sd/source/core/text/textapi.cxx b/sd/source/core/text/textapi.cxx new file mode 100644 index 000000000000..916e577b64e4 --- /dev/null +++ b/sd/source/core/text/textapi.cxx @@ -0,0 +1,325 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: textapi.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include "Outliner.hxx" + +using ::rtl::OUString; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::text; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::container; + +namespace sd { + +class UndoTextAPIChanged : public SdrUndoAction +{ +public: + UndoTextAPIChanged( SdrModel& rModel, TextApiObject* pTextObj ); + ~UndoTextAPIChanged(); + + virtual void Undo(); + virtual void Redo(); + +protected: + OutlinerParaObject* mpOldText; + OutlinerParaObject* mpNewText; + rtl::Reference< TextApiObject > mxTextObj; +}; + +UndoTextAPIChanged::UndoTextAPIChanged(SdrModel& rModel, TextApiObject* pTextObj ) +: SdrUndoAction( rModel ) +, mpOldText( pTextObj->CreateText() ) +, mpNewText( 0 ) +, mxTextObj( pTextObj ) +{ +} + +UndoTextAPIChanged::~UndoTextAPIChanged() +{ + delete mpOldText; + delete mpNewText; +} + +void UndoTextAPIChanged::Undo() +{ + if( !mpNewText ) + mpNewText = mxTextObj->CreateText(); + + mxTextObj->SetText( *mpOldText ); +} + +void UndoTextAPIChanged::Redo() +{ + if( mpNewText ) + { + mxTextObj->SetText( *mpNewText ); + } +} + +struct TextAPIEditSource_Impl +{ + // needed for "internal" refcounting + SdDrawDocument* mpDoc; + Outliner* mpOutliner; + SvxOutlinerForwarder* mpTextForwarder; + sal_Int32 mnRef; +}; + +class TextAPIEditSource : public SvxEditSource +{ + TextAPIEditSource_Impl* pImpl; + + virtual SvxEditSource* Clone() const; + virtual SvxTextForwarder* GetTextForwarder(); + virtual void UpdateData(); + explicit TextAPIEditSource( const TextAPIEditSource& rSource ); + +public: + TextAPIEditSource(SdDrawDocument* pDoc); + virtual ~TextAPIEditSource(); + + void Dispose(); + void SetText( OutlinerParaObject& rText ); + void SetString( const String& rText ); + OutlinerParaObject* CreateText(); + String GetText(); + SdDrawDocument* GetDoc() { return pImpl->mpDoc; } +}; + +const SvxItemPropertySet* ImplGetSdTextPortionPropertyMap() +{ + static const SfxItemPropertyMapEntry aSdTextPortionPropertyEntries[] = + { + SVX_UNOEDIT_CHAR_PROPERTIES, + SVX_UNOEDIT_FONT_PROPERTIES, + SVX_UNOEDIT_OUTLINER_PROPERTIES, + SVX_UNOEDIT_PARA_PROPERTIES, + {MAP_CHAR_LEN("TextField"), EE_FEATURE_FIELD, &::getCppuType((const Reference< XTextField >*)0), PropertyAttribute::READONLY, 0 }, + {MAP_CHAR_LEN("TextPortionType"), WID_PORTIONTYPE, &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0 }, + {MAP_CHAR_LEN("TextUserDefinedAttributes"), EE_CHAR_XMLATTRIBS, &::getCppuType((const Reference< XNameContainer >*)0) , 0, 0}, + {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const Reference< XNameContainer >*)0) , 0, 0}, + {0,0,0,0,0,0} + }; + static SvxItemPropertySet aSdTextPortionPropertyMap( aSdTextPortionPropertyEntries ); + + return &aSdTextPortionPropertyMap; +} + +TextApiObject::TextApiObject( TextAPIEditSource* pEditSource ) +: SvxUnoText( pEditSource, ImplGetSdTextPortionPropertyMap(), Reference < XText >() ) +, mpSource(pEditSource) +{ +} + +TextApiObject::~TextApiObject() throw() +{ + dispose(); +} + +rtl::Reference< TextApiObject > TextApiObject::create( SdDrawDocument* pDoc ) +{ + rtl::Reference< TextApiObject > xRet( new TextApiObject( new TextAPIEditSource( pDoc ) ) ); + return xRet; +} + +void SAL_CALL TextApiObject::dispose() throw(RuntimeException) +{ + if( mpSource ) + { + mpSource->Dispose(); + delete mpSource; + mpSource = 0; + } + + // SvxUnoText::dispose(); +} + +OutlinerParaObject* TextApiObject::CreateText() +{ + return mpSource->CreateText(); +} + +void TextApiObject::SetString( const String& rText ) +{ + SdrModel* pModel = mpSource->GetDoc(); + if( pModel && pModel->IsUndoEnabled() ) + pModel->AddUndo( new UndoTextAPIChanged( *pModel, this ) ); + + mpSource->SetString( rText ); + maSelection.nStartPara = 0xffff; +} + +void TextApiObject::SetText( OutlinerParaObject& rText ) +{ + SdrModel* pModel = mpSource->GetDoc(); + if( pModel && pModel->IsUndoEnabled() ) + pModel->AddUndo( new UndoTextAPIChanged( *pModel, this ) ); + + mpSource->SetText( rText ); + maSelection.nStartPara = 0xffff; +} + +String TextApiObject::GetText() +{ + return mpSource->GetText(); +} + +TextApiObject* TextApiObject::getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& xText ) +{ + TextApiObject* pImpl = dynamic_cast< TextApiObject* >( xText.get() ); + + if( !pImpl ) + pImpl = dynamic_cast< TextApiObject* >( SvxUnoTextBase::getImplementation( xText ) ); + + return pImpl; +} + +TextAPIEditSource::TextAPIEditSource( const TextAPIEditSource& rSource ) +: SvxEditSource( *this ) +{ + // shallow copy; uses internal refcounting + pImpl = rSource.pImpl; + pImpl->mnRef++; +} + +SvxEditSource* TextAPIEditSource::Clone() const +{ + return new TextAPIEditSource( *this ); +} + +void TextAPIEditSource::UpdateData() +{ + // data is kept in outliner all the time +} + +TextAPIEditSource::TextAPIEditSource(SdDrawDocument* pDoc) +: pImpl(new TextAPIEditSource_Impl) +{ + pImpl->mpDoc = pDoc; + pImpl->mpOutliner = 0; + pImpl->mpTextForwarder = 0; + pImpl->mnRef = 1; +} + +TextAPIEditSource::~TextAPIEditSource() +{ + if (!--pImpl->mnRef) + delete pImpl; +} + +void TextAPIEditSource::Dispose() +{ + pImpl->mpDoc=0; + delete pImpl->mpTextForwarder; + pImpl->mpTextForwarder = 0; + + delete pImpl->mpOutliner; + pImpl->mpOutliner = 0; +} + +SvxTextForwarder* TextAPIEditSource::GetTextForwarder() +{ + if( !pImpl->mpDoc ) + return 0; // mpDoc == 0 can be used to flag this as disposed + + if( !pImpl->mpOutliner ) + { + //init draw model first + pImpl->mpOutliner = new Outliner( pImpl->mpDoc, OUTLINERMODE_TEXTOBJECT ); + pImpl->mpDoc->SetCalcFieldValueHdl( pImpl->mpOutliner ); + } + + if( !pImpl->mpTextForwarder ) + pImpl->mpTextForwarder = new SvxOutlinerForwarder( *pImpl->mpOutliner, 0 ); + + return pImpl->mpTextForwarder; +} + +void TextAPIEditSource::SetText( OutlinerParaObject& rText ) +{ + if ( pImpl->mpDoc ) + { + if( !pImpl->mpOutliner ) + { + //init draw model first + pImpl->mpOutliner = new Outliner( pImpl->mpDoc, OUTLINERMODE_TEXTOBJECT ); + pImpl->mpDoc->SetCalcFieldValueHdl( pImpl->mpOutliner ); + } + + pImpl->mpOutliner->SetText( rText ); + } +} + +void TextAPIEditSource::SetString( const String& rText ) +{ + if ( pImpl->mpDoc ) + { + if( !pImpl->mpOutliner ) + { + //init draw model first + pImpl->mpOutliner = new Outliner( pImpl->mpDoc, OUTLINERMODE_TEXTOBJECT ); + pImpl->mpDoc->SetCalcFieldValueHdl( pImpl->mpOutliner ); + } + else + pImpl->mpOutliner->Clear(); + pImpl->mpOutliner->Insert( rText ); + } +} + +OutlinerParaObject* TextAPIEditSource::CreateText() +{ + if ( pImpl->mpDoc && pImpl->mpOutliner ) + return pImpl->mpOutliner->CreateParaObject(); + else + return 0; +} + +String TextAPIEditSource::GetText() +{ + if ( pImpl->mpDoc && pImpl->mpOutliner ) + return pImpl->mpOutliner->GetEditEngine().GetText(); + else + return String(); +} + +} // namespace sd diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index 2c313d97f2ac..cb31e99aec63 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -50,6 +50,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include #include @@ -402,17 +407,17 @@ void PPTWriter::ImplCreateHeaderFooterStrings( SvStream& rStrm, ::com::sun::star if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "HeaderText" ) ), sal_True ) ) { if ( aAny >>= aString ) - ImplWriteCString( rStrm, aString, 1 ); + PPTWriter::WriteCString( rStrm, aString, 1 ); } if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FooterText" ) ), sal_True ) ) { if ( aAny >>= aString ) - ImplWriteCString( rStrm, aString, 2 ); + PPTWriter::WriteCString( rStrm, aString, 2 ); } if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "DateTimeText" ) ), sal_True ) ) { if ( aAny >>= aString ) - ImplWriteCString( rStrm, aString, 0 ); + PPTWriter::WriteCString( rStrm, aString, 0 ); } } } @@ -1206,6 +1211,93 @@ sal_Bool PPTWriter::ImplCreateMainNotes() // --------------------------------------------------------------------------------------------- +static rtl::OUString getInitials( const rtl::OUString& rName ) +{ + rtl::OUString sInitials; + + const sal_Unicode * pStr = rName.getStr(); + sal_Int32 nLength = rName.getLength(); + + while( nLength ) + { + // skip whitespace + while( nLength && (*pStr <= ' ') ) + { + nLength--; pStr++; + } + + // take letter + if( nLength ) + { + sInitials += rtl::OUString( *pStr ); + nLength--; pStr++; + } + + // skip letters until whitespace + while( nLength && (*pStr > ' ') ) + { + nLength--; pStr++; + } + } + + return sInitials; +} + +void ImplExportComments( uno::Reference< drawing::XDrawPage > xPage, SvMemoryStream& rBinaryTagData10Atom ) +{ + try + { + uno::Reference< office::XAnnotationAccess > xAnnotationAccess( xPage, uno::UNO_QUERY_THROW ); + uno::Reference< office::XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() ); + + sal_Int32 nIndex = 1; + + while( xAnnotationEnumeration->hasMoreElements() ) + { + EscherExContainer aComment10( rBinaryTagData10Atom, EPP_Comment10 ); + { + uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() ); + + geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() ); + MapMode aMapDest( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) ); + Point aPoint( OutputDevice::LogicToLogic( Point( static_cast< sal_Int32 >( aRealPoint2D.X * 100.0 ), + static_cast< sal_Int32 >( aRealPoint2D.Y * 100.0 ) ), MAP_100TH_MM, aMapDest ) ); + + rtl::OUString sAuthor( xAnnotation->getAuthor() ); + uno::Reference< text::XText > xText( xAnnotation->getTextRange() ); + rtl::OUString sText( xText->getString() ); + rtl::OUString sInitials( getInitials( sAuthor ) ); + util::DateTime aDateTime( xAnnotation->getDateTime() ); + if ( sAuthor.getLength() ) + PPTWriter::WriteCString( rBinaryTagData10Atom, sAuthor, 0 ); + if ( sText.getLength() ) + PPTWriter::WriteCString( rBinaryTagData10Atom, sText, 1 ); + if ( sInitials.getLength() ) + PPTWriter::WriteCString( rBinaryTagData10Atom, sInitials, 2 ); + + sal_Int16 nMilliSeconds = aDateTime.HundredthSeconds * 10; + EscherExAtom aCommentAtom10( rBinaryTagData10Atom, EPP_CommentAtom10 ); + rBinaryTagData10Atom << nIndex++ + << aDateTime.Year + << aDateTime.Month + << aDateTime.Day // todo: day of week + << aDateTime.Day + << aDateTime.Hours + << aDateTime.Minutes + << aDateTime.Seconds + << nMilliSeconds + << static_cast< sal_Int32 >( aPoint.X() ) + << static_cast< sal_Int32 >( aPoint.Y() ); + } + } + } + catch ( uno::Exception& ) + { + } +} + +// --------------------------------------------------------------------------------------------- + sal_Bool PPTWriter::ImplCreateSlide( sal_uInt32 nPageNum ) { ::com::sun::star::uno::Any aAny; @@ -1567,6 +1659,49 @@ sal_Bool PPTWriter::ImplCreateSlide( sal_uInt32 nPageNum ) mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 ); *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2; + SvMemoryStream aBinaryTagData10Atom; + ImplExportComments( mXDrawPage, aBinaryTagData10Atom ); + if ( mbUseNewAnimations ) + { + SvMemoryStream amsofbtAnimGroup; + ppt::AnimationExporter aExporter( aSolverContainer, maSoundCollection ); + aExporter.doexport( mXDrawPage, amsofbtAnimGroup ); + sal_uInt32 nmsofbtAnimGroupSize = amsofbtAnimGroup.Tell(); + if ( nmsofbtAnimGroupSize ) + { + { + EscherExAtom aMagic2( aBinaryTagData10Atom, 0x2eeb ); + aBinaryTagData10Atom << (sal_uInt32)0x01c45df9 + << (sal_uInt32)0xe1471b30; + } + { + EscherExAtom aMagic( aBinaryTagData10Atom, 0x2b00 ); + aBinaryTagData10Atom << (sal_uInt32)0; + } + aBinaryTagData10Atom.Write( amsofbtAnimGroup.GetData(), amsofbtAnimGroup.Tell() ); + { + EscherExContainer aMagic2( aBinaryTagData10Atom, 0x2b02 ); + } + } + } + if ( aBinaryTagData10Atom.Tell() ) + { + EscherExContainer aProgTags ( *mpStrm, EPP_ProgTags ); + EscherExContainer aProgBinaryTag( *mpStrm, EPP_ProgBinaryTag ); + { + EscherExAtom aCString( *mpStrm, EPP_CString ); + *mpStrm << (sal_uInt32)0x5f005f + << (sal_uInt32)0x50005f + << (sal_uInt32)0x540050 + << (sal_uInt16)0x31 + << (sal_uInt16)0x30; + } + { + EscherExAtom aBinaryTagData( *mpStrm, EPP_BinaryTagData ); + mpStrm->Write( aBinaryTagData10Atom.GetData(), aBinaryTagData10Atom.Tell() ); + } + } +/* if ( mbUseNewAnimations ) { SvMemoryStream amsofbtAnimGroup; @@ -1605,6 +1740,7 @@ sal_Bool PPTWriter::ImplCreateSlide( sal_uInt32 nPageNum ) } } } +*/ mpPptEscherEx->CloseContainer(); // EPP_Slide return TRUE; }; @@ -1722,18 +1858,6 @@ void PPTWriter::ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::su mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer } -void PPTWriter::ImplWriteCString( SvStream& rSt, const String& rString, sal_uInt32 nInstance ) -{ - sal_uInt32 i, nLen = rString.Len(); - if ( nLen ) - { - rSt << (sal_uInt32)( ( nInstance << 4 ) | ( EPP_CString << 16 ) ) - << (sal_uInt32)( nLen << 1 ); - for ( i = 0; i < nLen; i++ ) - rSt << rString.GetChar( (sal_uInt16)i ); - } -} - void PPTWriter::ImplWriteVBA( SvMemoryStream* pVBA ) { if ( pVBA ) diff --git a/sd/source/filter/eppt/eppt.hxx b/sd/source/filter/eppt/eppt.hxx index 8bf1b84bcd07..84b64e33157c 100644 --- a/sd/source/filter/eppt/eppt.hxx +++ b/sd/source/filter/eppt/eppt.hxx @@ -775,6 +775,9 @@ class PPTWriter : public GroupTable, public PropValue, public PPTExBulletProvide sal_uInt32 ImplDocumentListContainer( SvStream* pOutStrm = NULL ); sal_uInt32 ImplMasterSlideListContainer( SvStream* pOutStrm = NULL ); + public: + static void WriteCString( SvStream&, const String&, sal_uInt32 nInstance = 0 ); + protected: sal_Bool ImplCreateDocumentSummaryInformation( sal_uInt32 nCnvrtFlags ); @@ -835,7 +838,6 @@ class PPTWriter : public GroupTable, public PropValue, public PPTExBulletProvide Rectangle ImplMapRectangle( const ::com::sun::star::awt::Rectangle& ); sal_Bool ImplCloseDocument(); // die font-, hyper-, Soundliste wird geschrieben .. - void ImplWriteCString( SvStream&, const String&, sal_uInt32 nInstance = 0 ); public: PPTWriter( SvStorageRef& rSvStorage, diff --git a/sd/source/filter/eppt/epptdef.hxx b/sd/source/filter/eppt/epptdef.hxx index 788b668e14ba..f0b4460f9db0 100644 --- a/sd/source/filter/eppt/epptdef.hxx +++ b/sd/source/filter/eppt/epptdef.hxx @@ -214,6 +214,9 @@ #define EPP_GscalingAtom 10001 #define EPP_GrColorAtom 10002 #define EPP_GLPointAtom 10003 +#define EPP_Comment10 12000 +#define EPP_CommentAtom10 12001 + #define EPP_PLACEHOLDER_NONE 0 // 0 None #define EPP_PLACEHOLDER_MASTERTITLE 1 // 1 Master title diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 55f7f2064815..75e5a4ba3227 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -4605,11 +4605,11 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a } } if ( aControlName.Len() ) - ImplWriteCString( *mpExEmbed, aControlName, 1 ); + PPTWriter::WriteCString( *mpExEmbed, aControlName, 1 ); if ( aOleIdentifier.Len() ) - ImplWriteCString( *mpExEmbed, aOleIdentifier, 2 ); + PPTWriter::WriteCString( *mpExEmbed, aOleIdentifier, 2 ); if ( aUserName.Len() ) - ImplWriteCString( *mpExEmbed, aUserName, 3 ); + PPTWriter::WriteCString( *mpExEmbed, aUserName, 3 ); } nSize = mpExEmbed->Tell() - nOldPos; mpExEmbed->Seek( nOldPos - 4 ); @@ -5094,9 +5094,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a << (sal_uInt32)0 << (sal_uInt32)0x0012b600; -// ImplWriteCString( *mpExEmbed, "Photo Editor Photo", 1 ); -// ImplWriteCString( *mpExEmbed, "MSPhotoEd.3", 2 ); -// ImplWriteCString( *mpExEmbed, "Microsoft Photo Editor 3.0 Photo", 3 ); +// PPTWriter::WriteCString( *mpExEmbed, "Photo Editor Photo", 1 ); +// PPTWriter::WriteCString( *mpExEmbed, "MSPhotoEd.3", 2 ); +// PPTWriter::WriteCString( *mpExEmbed, "Microsoft Photo Editor 3.0 Photo", 3 ); nSize = mpExEmbed->Tell() - nOldPos; mpExEmbed->Seek( nOldPos - 4 ); @@ -5573,6 +5573,18 @@ void PPTWriter::ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 n } } +void PPTWriter::WriteCString( SvStream& rSt, const String& rString, sal_uInt32 nInstance ) +{ + sal_uInt32 i, nLen = rString.Len(); + if ( nLen ) + { + rSt << (sal_uInt32)( ( nInstance << 4 ) | ( EPP_CString << 16 ) ) + << (sal_uInt32)( nLen << 1 ); + for ( i = 0; i < nLen; i++ ) + rSt << rString.GetChar( (sal_uInt16)i ); + } +} + void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer, EscherPropertyContainer& aPropOpt ) { diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx new file mode 100644 index 000000000000..144022d10758 --- /dev/null +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -0,0 +1,1264 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AnnotationManagerImpl.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include "sddll.hxx" + +//#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "annotationmanager.hxx" +#include "annotationmanagerimpl.hxx" +#include "annotationwindow.hxx" +#include "annotations.hrc" + +#include "ToolBarManager.hxx" +#include "DrawDocShell.hxx" +#include "DrawViewShell.hxx" +#include "DrawController.hxx" +#include "glob.hrc" +#include "sdresid.hxx" +#include "EventMultiplexer.hxx" +#include "ViewShellManager.hxx" +#include "helpids.h" +#include "sdpage.hxx" +#include "drawdoc.hxx" +#include "textapi.hxx" +#include "optsitem.hxx" + +#define C2U(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) +using ::rtl::OUString; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::drawing; +using namespace ::com::sun::star::document; +using namespace ::com::sun::star::geometry; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::text; +using namespace ::com::sun::star::view; +using namespace ::com::sun::star::style; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::ui; +using namespace ::com::sun::star::task; +using namespace ::com::sun::star::office; + +namespace sd { + +// -------------------------------------------------------------------- + +extern TextApiObject* getTextApiObject( const Reference< XAnnotation >& xAnnotation ); + +// -------------------------------------------------------------------- + +SfxItemPool* GetAnnotationPool() +{ + static SfxItemPool* mpAnnotationPool = 0; + if( mpAnnotationPool == 0 ) + { + mpAnnotationPool = EditEngine::CreatePool( sal_False ); + mpAnnotationPool->SetPoolDefaultItem(SvxFontHeightItem(423,100,EE_CHAR_FONTHEIGHT)); + + Font aAppFont( Application::GetSettings().GetStyleSettings().GetAppFont() ); + String EMPTYSTRING; + mpAnnotationPool->SetPoolDefaultItem(SvxFontItem(aAppFont.GetFamily(),aAppFont.GetName(), EMPTYSTRING,PITCH_DONTKNOW,RTL_TEXTENCODING_DONTKNOW,EE_CHAR_FONTINFO)); + } + + return mpAnnotationPool; +} + +// -------------------------------------------------------------------- + +static SfxBindings* getBindings( ViewShellBase& rBase ) +{ + if( rBase.GetMainViewShell().get() && rBase.GetMainViewShell()->GetViewFrame() ) + return &rBase.GetMainViewShell()->GetViewFrame()->GetBindings(); + else + return 0; +} + +// -------------------------------------------------------------------- + +static SfxDispatcher* getDispatcher( ViewShellBase& rBase ) +{ + if( rBase.GetMainViewShell().get() && rBase.GetMainViewShell()->GetViewFrame() ) + return rBase.GetMainViewShell()->GetViewFrame()->GetDispatcher(); + else + return 0; +} + +com::sun::star::util::DateTime getCurrentDateTime() +{ + TimeValue osltime; + osl_getSystemTime( &osltime ); + oslDateTime osldt; + osl_getDateTimeFromTimeValue( &osltime, &osldt ); + return com::sun::star::util::DateTime( 0, osldt.Seconds, osldt.Minutes, osldt.Hours, osldt.Day, osldt.Month, osldt.Year ); +} + +OUString getAnnotationDateTimeString( const Reference< XAnnotation >& xAnnotation ) +{ + OUString sRet; + if( xAnnotation.is() ) + { + const LocaleDataWrapper& rLocalData = SvtSysLocale().GetLocaleData(); + + com::sun::star::util::DateTime aDateTime( xAnnotation->getDateTime() ); + + Date aDate = Date( aDateTime.Day, aDateTime.Month, aDateTime.Year ); + if (aDate==Date()) + sRet = sRet + String(SdResId(STR_ANNOTATION_TODAY)); + else + if (aDate == Date(Date()-1)) + sRet = sRet + String(SdResId(STR_ANNOTATION_YESTERDAY)); + else + if (aDate.IsValid() ) + sRet = sRet + rLocalData.getDate(aDate); + + Time aTime( aDateTime.Hours, aDateTime.Minutes, aDateTime.Seconds, aDateTime.HundredthSeconds ); + if(aTime.GetTime() != 0) + sRet = sRet + rtl::OUString::createFromAscii(" ") + rLocalData.getTime( aTime,false ); + } + return sRet; +} + +// -------------------------------------------------------------------- + +AnnotationManagerImpl::AnnotationManagerImpl( ViewShellBase& rViewShellBase ) +: AnnotationManagerImplBase( m_aMutex ) +, mrBase( rViewShellBase ) +, mpDoc( rViewShellBase.GetDocument() ) +, mbShowAnnotations( true ) +, mnUpdateTagsEvent( 0 ) +{ + SdOptions* pOptions = SD_MOD()->GetSdOptions(mpDoc->GetDocumentType()); + if( pOptions ) + mbShowAnnotations = pOptions->IsPreviewTransitions() == sal_True; +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::init() +{ + // get current controller and initialize listeners + try + { + addListener(); + mxView = Reference< XDrawView >::query(mrBase.GetController()); + } + catch( Exception& e ) + { + (void)e; + DBG_ERROR( "sd::AnnotationManagerImpl::AnnotationManagerImpl(), Exception caught!" ); + } + + try + { + Reference xModel (mrBase.GetDocShell()->GetModel(), UNO_QUERY_THROW ); + Reference xListener( this ); + xModel->addEventListener( xListener ); + } + catch( Exception& ) + { + } +} + +// -------------------------------------------------------------------- + +// WeakComponentImplHelper1 +void SAL_CALL AnnotationManagerImpl::disposing () +{ + try + { + Reference xModel (mrBase.GetDocShell()->GetModel(), UNO_QUERY_THROW ); + Reference xListener( this ); + xModel->removeEventListener( xListener ); + } + catch( Exception& ) + { + } + + removeListener(); + DisposeTags(); + + if( mnUpdateTagsEvent ) + { + Application::RemoveUserEvent( mnUpdateTagsEvent ); + mnUpdateTagsEvent = 0; + } + + mxView.clear(); + mxCurrentPage.clear(); +} + +// -------------------------------------------------------------------- + +// XEventListener +void SAL_CALL AnnotationManagerImpl::notifyEvent( const ::com::sun::star::document::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException) +{ + if( aEvent.EventName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OnAnnotationInserted") ) || + aEvent.EventName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OnAnnotationRemoved") ) || + aEvent.EventName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OnAnnotationChanged" )) ) + { + UpdateTags(); + } +} + +void SAL_CALL AnnotationManagerImpl::disposing( const ::com::sun::star::lang::EventObject& /*Source*/ ) throw (::com::sun::star::uno::RuntimeException) +{ +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::ExecuteAnnotation(SfxRequest& rReq ) +{ + switch( rReq.GetSlot() ) + { + case SID_INSERT_POSTIT: + ExecuteInsertAnnotation( rReq ); + break; + case SID_DELETE_POSTIT: + case SID_DELETEALL_POSTIT: + case SID_DELETEALLBYAUTHOR_POSTIT: + ExecuteDeleteAnnotation( rReq ); + break; + case SID_PREVIOUS_POSTIT: + case SID_NEXT_POSTIT: + SelectNextAnnotation( rReq.GetSlot() == SID_NEXT_POSTIT ); + break; + case SID_REPLYTO_POSTIT: + ExecuteReplyToAnnotation( rReq ); + break; + case SID_SHOW_POSTIT: + { + mbShowAnnotations = !mbShowAnnotations; + + SdOptions* pOptions = SD_MOD()->GetSdOptions(mpDoc->GetDocumentType()); + if( pOptions ) + pOptions->SetShowComments( mbShowAnnotations ? sal_True : sal_False ); + + UpdateTags(); + break; + } + } +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::ExecuteInsertAnnotation(SfxRequest& /*rReq*/) +{ + InsertAnnotation(); +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest& rReq) +{ + const SfxItemSet* pArgs = rReq.GetArgs(); + + switch( rReq.GetSlot() ) + { + case SID_DELETEALL_POSTIT: + DeleteAllAnnotations(); + break; + case SID_DELETEALLBYAUTHOR_POSTIT: + if( pArgs ) + { + const SfxPoolItem* pPoolItem = NULL; + if( SFX_ITEM_SET == pArgs->GetItemState( SID_DELETE_POSTIT, TRUE, &pPoolItem ) ) + { + OUString sAuthor( (( const SfxStringItem* ) pPoolItem )->GetValue() ); + DeleteAnnotationsByAuthor( sAuthor ); + } + } + break; + case SID_DELETE_POSTIT: + { + Reference< XAnnotation > xAnnotation; + + if( rReq.GetSlot() == SID_DELETE_POSTIT ) + { + if( pArgs ) + { + const SfxPoolItem* pPoolItem = NULL; + if( SFX_ITEM_SET == pArgs->GetItemState( SID_DELETE_POSTIT, TRUE, &pPoolItem ) ) + ( ( const SfxUnoAnyItem* ) pPoolItem )->GetValue() >>= xAnnotation; + } + } + + if( !xAnnotation.is() ) + GetSelectedAnnotation( xAnnotation ); + + DeleteAnnotation( xAnnotation ); + } + break; + } + + UpdateTags(); +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::InsertAnnotation() +{ + SdPage* pPage = GetCurrentPage(); + if( pPage ) + { + if( mpDoc->IsUndoEnabled() ) + mpDoc->BegUndo( String( SdResId( STR_ANNOTATION_UNDO_INSERT ) ) ); + + // find free space for new annotation + int y = 0, x = 0; + + AnnotationVector aAnnotations( pPage->getAnnotations() ); + if( !aAnnotations.empty() ) + { + const int page_width = pPage->GetSize().Width(); + const int width = 1000; + const int height = 800; + Rectangle aTagRect; + + while( true ) + { + Rectangle aNewRect( x, y, x + width - 1, y + height - 1 ); + bool bFree = true; + + for( AnnotationVector::iterator iter = aAnnotations.begin(); iter != aAnnotations.end(); iter++ ) + { + RealPoint2D aPoint( (*iter)->getPosition() ); + aTagRect.nLeft = sal::static_int_cast< long >( aPoint.X * 100.0 ); + aTagRect.nTop = sal::static_int_cast< long >( aPoint.Y * 100.0 ); + aTagRect.nRight = aTagRect.nLeft + width - 1; + aTagRect.nBottom = aTagRect.nTop + height - 1; + + if( aNewRect.IsOver( aTagRect ) ) + { + bFree = false; + break; + } + } + + if( bFree == false) + { + x += width; + if( x > page_width ) + { + x = 0; + y += height; + } + } + else + { + break; + } + } + } + + Reference< XAnnotation > xAnnotation; + pPage->createAnnotation( xAnnotation ); + + // set current author to new annotation + SvtUserOptions aUserOptions; + xAnnotation->setAuthor( aUserOptions.GetFullName() ); + + // set current time to new annotation + xAnnotation->setDateTime( getCurrentDateTime() ); + + // set position + RealPoint2D aPos( ((double)x) / 100.0, ((double)y) / 100.0 ); + xAnnotation->setPosition( aPos ); + + if( mpDoc->IsUndoEnabled() ) + mpDoc->EndUndo(); + + UpdateTags(true); + SelectAnnotation( xAnnotation, true ); + } +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest& rReq ) +{ + Reference< XAnnotation > xAnnotation; + const SfxItemSet* pArgs = rReq.GetArgs(); + if( pArgs ) + { + const SfxPoolItem* pPoolItem = NULL; + if( SFX_ITEM_SET == pArgs->GetItemState( rReq.GetSlot(), TRUE, &pPoolItem ) ) + ( ( const SfxUnoAnyItem* ) pPoolItem )->GetValue() >>= xAnnotation; + } + + + TextApiObject* pTextApi = getTextApiObject( xAnnotation ); + if( pTextApi ) + { + std::auto_ptr< ::Outliner > pOutliner( new ::Outliner(GetAnnotationPool(),OUTLINERMODE_TEXTOBJECT) ); + + mpDoc->SetCalcFieldValueHdl( pOutliner.get() ); + pOutliner->SetUpdateMode( TRUE ); + + String aStr(SdResId(STR_ANNOTATION_REPLY)); + OUString sAuthor( xAnnotation->getAuthor() ); + if( sAuthor.getLength() == 0 ) + sAuthor = String( SdResId( STR_ANNOTATION_NOAUTHOR ) ); + + aStr.SearchAndReplaceAscii("%1", sAuthor); + + aStr.Append( String(RTL_CONSTASCII_USTRINGPARAM(" (") ) ); + aStr.Append( String( getAnnotationDateTimeString( xAnnotation ) ) ); + aStr.Append( String(RTL_CONSTASCII_USTRINGPARAM("): \"") ) ); + + String sQuote( pTextApi->GetText() ); + + if( sQuote.Len() == 0 ) + sQuote = String( RTL_CONSTASCII_USTRINGPARAM( "..." ) ); + aStr.Append( sQuote ); + aStr.Append( String(RTL_CONSTASCII_USTRINGPARAM("\"\n") ) ); + + USHORT nParaCount = aStr.GetTokenCount( '\n' ); + for( USHORT nPara = 0; nPara < nParaCount; nPara++ ) + pOutliner->Insert( aStr.GetToken( nPara, '\n' ), LIST_APPEND, -1 ); + + if( pOutliner->GetParagraphCount() > 1 ) + { + SfxItemSet aAnswerSet( pOutliner->GetEmptyItemSet() ); + aAnswerSet.Put(SvxPostureItem(ITALIC_NORMAL,EE_CHAR_ITALIC)); + + ESelection aSel; + aSel.nEndPara = (USHORT)pOutliner->GetParagraphCount()-2; + aSel.nEndPos = pOutliner->GetText( pOutliner->GetParagraph( aSel.nEndPara ) ).Len(); + + pOutliner->QuickSetAttribs( aAnswerSet, aSel ); + } + + std::auto_ptr< OutlinerParaObject > pOPO( pOutliner->CreateParaObject() ); + pTextApi->SetText( *pOPO.get() ); + + SvtUserOptions aUserOptions; + xAnnotation->setAuthor( aUserOptions.GetFullName() ); + + // set current time to reply + xAnnotation->setDateTime( getCurrentDateTime() ); + + UpdateTags(true); + SelectAnnotation( xAnnotation, true ); + } +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::DeleteAnnotation( Reference< XAnnotation > xAnnotation ) +{ + SdPage* pPage = GetCurrentPage(); + + if( xAnnotation.is() && pPage ) + { + if( mpDoc->IsUndoEnabled() ) + mpDoc->BegUndo( String( SdResId( STR_ANNOTATION_UNDO_DELETE ) ) ); + + pPage->removeAnnotation( xAnnotation ); + + if( mpDoc->IsUndoEnabled() ) + mpDoc->EndUndo(); + + UpdateTags(); + } +} + +void AnnotationManagerImpl::DeleteAnnotationsByAuthor( const rtl::OUString& sAuthor ) +{ + if( mpDoc->IsUndoEnabled() ) + mpDoc->BegUndo( String( SdResId( STR_ANNOTATION_UNDO_DELETE ) ) ); + + SdPage* pPage = 0; + do + { + pPage = GetNextPage( pPage, true ); + + if( pPage && !pPage->getAnnotations().empty() ) + { + AnnotationVector aAnnotations( pPage->getAnnotations() ); + for( AnnotationVector::iterator iter = aAnnotations.begin(); iter != aAnnotations.end(); iter++ ) + { + Reference< XAnnotation > xAnnotation( *iter ); + if( xAnnotation->getAuthor() == sAuthor ) + { + if( mxSelectedAnnotation == xAnnotation ) + mxSelectedAnnotation.clear(); + pPage->removeAnnotation( xAnnotation ); + } + } + } + } while( pPage ); + + if( mpDoc->IsUndoEnabled() ) + mpDoc->EndUndo(); +} + +void AnnotationManagerImpl::DeleteAllAnnotations() +{ + if( mpDoc->IsUndoEnabled() ) + mpDoc->BegUndo( String( SdResId( STR_ANNOTATION_UNDO_DELETE ) ) ); + + SdPage* pPage = 0; + do + { + pPage = GetNextPage( pPage, true ); + + if( pPage && !pPage->getAnnotations().empty() ) + { + + AnnotationVector aAnnotations( pPage->getAnnotations() ); + for( AnnotationVector::iterator iter = aAnnotations.begin(); iter != aAnnotations.end(); iter++ ) + { + pPage->removeAnnotation( (*iter) ); + } + } + } + while( pPage ); + + mxSelectedAnnotation.clear(); + + if( mpDoc->IsUndoEnabled() ) + mpDoc->EndUndo(); +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::GetAnnotationState(SfxItemSet& rSet) +{ + SdPage* pCurrentPage = GetCurrentPage(); + + const bool bReadOnly = mrBase.GetDocShell()->IsReadOnly(); + const bool bWrongPageKind = (pCurrentPage == 0) || (pCurrentPage->GetPageKind() != PK_STANDARD); + + const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); + + if( bReadOnly || bWrongPageKind || (nCurrentODFVersion != SvtSaveOptions::ODFVER_LATEST) ) + rSet.DisableItem( SID_INSERT_POSTIT ); + + rSet.Put(SfxBoolItem(SID_SHOW_POSTIT, mbShowAnnotations)); + + Reference< XAnnotation > xAnnotation; + GetSelectedAnnotation( xAnnotation ); + + if( !xAnnotation.is() || bReadOnly ) + rSet.DisableItem( SID_DELETE_POSTIT ); + + SdPage* pPage = 0; + + bool bHasAnnotations = false; + do + { + pPage = GetNextPage( pPage, true ); + + if( pPage && !pPage->getAnnotations().empty() ) + bHasAnnotations = true; + } + while( pPage && !bHasAnnotations ); + + if( !bHasAnnotations || bReadOnly ) + { + rSet.DisableItem( SID_DELETEALL_POSTIT ); + } + + if( bWrongPageKind || !bHasAnnotations ) + { + rSet.DisableItem( SID_PREVIOUS_POSTIT ); + rSet.DisableItem( SID_NEXT_POSTIT ); + } +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::SelectNextAnnotation(bool bForeward) +{ + Reference< XAnnotation > xCurrent; + GetSelectedAnnotation( xCurrent ); + SdPage* pPage = GetCurrentPage(); + if( !pPage ) + return; + + AnnotationVector aAnnotations( pPage->getAnnotations() ); + + if( bForeward ) + { + if( xCurrent.is() ) + { + for( AnnotationVector::iterator iter = aAnnotations.begin(); iter != aAnnotations.end(); iter++ ) + { + if( (*iter) == xCurrent ) + { + iter++; + if( iter != aAnnotations.end() ) + { + SelectAnnotation( (*iter) ); + return; + } + break; + } + } + } + else if( !aAnnotations.empty() ) + { + SelectAnnotation( *(aAnnotations.begin()) ); + return; + } + } + else + { + if( xCurrent.is() ) + { + for( AnnotationVector::iterator iter = aAnnotations.begin(); iter != aAnnotations.end(); iter++ ) + { + if( (*iter) == xCurrent ) + { + if( iter != aAnnotations.begin() ) + { + iter--; + SelectAnnotation( (*iter) ); + return; + + } + break; + } + } + } + else if( !aAnnotations.empty() ) + { + AnnotationVector::iterator iter( aAnnotations.end() ); + SelectAnnotation( *(--iter) ); + return; + } + } + + mxSelectedAnnotation.clear(); + do + { + do + { + pPage = GetNextPage( pPage, bForeward ); + + if( pPage && !pPage->getAnnotations().empty() ) + { + // switch to next/previous slide with annotations + ::boost::shared_ptr pDrawViewShell(::boost::dynamic_pointer_cast(mrBase.GetMainViewShell())); + if (pDrawViewShell.get() != NULL) + { + pDrawViewShell->ChangeEditMode(pPage->IsMasterPage() ? EM_MASTERPAGE : EM_PAGE, FALSE); + pDrawViewShell->SwitchPage((pPage->GetPageNum() - 1) >> 1); + + SfxDispatcher* pDispatcher = getDispatcher( mrBase ); + if( pDispatcher ) + pDispatcher->Execute( bForeward ? SID_NEXT_POSTIT : SID_PREVIOUS_POSTIT ); + + return; + } + } + } + while( pPage ); + + // The question text depends on the search direction. + bool bImpress = mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS; + sal_uInt16 nStringId; + if(bForeward) + nStringId = bImpress ? STR_ANNOTATION_WRAP_FORWARD : STR_ANNOTATION_WRAP_FORWARD_DRAW; + else + nStringId = bImpress ? STR_ANNOTATION_WRAP_BACKWARD : STR_ANNOTATION_WRAP_BACKWARD_DRAW; + + // Pop up question box that asks the user whether to wrap arround. + // The dialog is made modal with respect to the whole application. + QueryBox aQuestionBox ( + NULL, + WB_YES_NO | WB_DEF_YES, + String(SdResId(nStringId))); + aQuestionBox.SetImage (QueryBox::GetStandardImage()); + USHORT nBoxResult = aQuestionBox.Execute(); + if(nBoxResult != BUTTONID_YES) + break; + } + while( true ); +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::onTagSelected( AnnotationTag& rTag ) +{ + mxSelectedAnnotation = rTag.GetAnnotation(); + invalidateSlots(); +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::onTagDeselected( AnnotationTag& rTag ) +{ + if( rTag.GetAnnotation() == mxSelectedAnnotation ) + { + mxSelectedAnnotation.clear(); + invalidateSlots(); + } +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::SelectAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > xAnnotation, bool bEdit /* = FALSE */ ) +{ + mxSelectedAnnotation = xAnnotation; + + for( AnnotationTagVector::iterator iter( maTagVector.begin() ); iter != maTagVector.end(); iter++ ) + { + if( (*iter)->GetAnnotation() == xAnnotation ) + { + SmartTagReference xTag( (*iter).get() ); + mrBase.GetMainViewShell()->GetView()->getSmartTags().select( xTag ); + (*iter)->OpenPopup( bEdit ); + break; + } + } +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::GetSelectedAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation ) +{ + xAnnotation = mxSelectedAnnotation; +} + +void AnnotationManagerImpl::invalidateSlots() +{ + SfxBindings* pBindings = getBindings( mrBase ); + if( pBindings ) + { + pBindings->Invalidate( SID_INSERT_POSTIT ); + pBindings->Invalidate( SID_DELETE_POSTIT ); + pBindings->Invalidate( SID_DELETEALL_POSTIT ); + pBindings->Invalidate( SID_PREVIOUS_POSTIT ); + pBindings->Invalidate( SID_NEXT_POSTIT ); + pBindings->Invalidate( SID_UNDO ); + pBindings->Invalidate( SID_REDO ); + } +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::onSelectionChanged() +{ + if( mxView.is() && mrBase.GetDrawView() ) try + { + Reference< XAnnotationAccess > xPage( mxView->getCurrentPage(), UNO_QUERY ); + + if( xPage != mxCurrentPage ) + { + mxCurrentPage = xPage; + + UpdateTags(true); + } + } + catch( Exception& ) + { + DBG_ERROR( "sd::AnnotationManagerImpl::onSelectionChanged(), exception caught!" ); + } +} + +void AnnotationManagerImpl::UpdateTags( bool bSynchron ) +{ + if( bSynchron ) + { + if( mnUpdateTagsEvent ) + Application::RemoveUserEvent( mnUpdateTagsEvent ); + + UpdateTagsHdl(0); + } + else + { + if( !mnUpdateTagsEvent && mxView.is() ) + mnUpdateTagsEvent = Application::PostUserEvent( LINK( this, AnnotationManagerImpl, UpdateTagsHdl ) ); + } +} + +IMPL_LINK(AnnotationManagerImpl,UpdateTagsHdl, void *, EMPTYARG) +{ + mnUpdateTagsEvent = 0; + DisposeTags(); + + if( mbShowAnnotations ) + CreateTags(); + + if( mrBase.GetDrawView() ) + static_cast< ::sd::View* >( mrBase.GetDrawView() )->updateHandles(); + + invalidateSlots(); + + return 0; +} + +void AnnotationManagerImpl::CreateTags() +{ + + if( mxCurrentPage.is() && mpDoc ) try + { + int nIndex = 1; + maFont = Application::GetSettings().GetStyleSettings().GetAppFont(); + + rtl::Reference< AnnotationTag > xSelectedTag; + + Reference< XAnnotationEnumeration > xEnum( mxCurrentPage->createAnnotationEnumeration() ); + while( xEnum->hasMoreElements() ) + { + Reference< XAnnotation > xAnnotation( xEnum->nextElement() ); + Color aColor( GetColorLight( mpDoc->GetAnnotationAuthorIndex( xAnnotation->getAuthor() ) ) ); + rtl::Reference< AnnotationTag > xTag( new AnnotationTag( *this, *mrBase.GetMainViewShell()->GetView(), xAnnotation, aColor, nIndex++, maFont ) ); + maTagVector.push_back(xTag); + + if( xAnnotation == mxSelectedAnnotation ) + { + xSelectedTag = xTag; + } + } + + if( xSelectedTag.is() ) + { + SmartTagReference xTag( xSelectedTag.get() ); + mrBase.GetMainViewShell()->GetView()->getSmartTags().select( xTag ); + } + else + { + // no tag, no selection! + mxSelectedAnnotation.clear(); + } + } + catch( Exception& ) + { + DBG_ERROR( "sd::AnnotationManagerImpl::onSelectionChanged(), exception caught!" ); + } +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::DisposeTags() +{ + if( !maTagVector.empty() ) + { + AnnotationTagVector::iterator iter = maTagVector.begin(); + do + { + (*iter++)->Dispose(); + } + while( iter != maTagVector.end() ); + + maTagVector.clear(); + } +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::addListener() +{ + Link aLink( LINK(this,AnnotationManagerImpl,EventMultiplexerListener) ); + mrBase.GetEventMultiplexer()->AddEventListener ( + aLink, + tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION + | tools::EventMultiplexerEvent::EID_CURRENT_PAGE + | tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED + | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED); +} + +// -------------------------------------------------------------------- + +void AnnotationManagerImpl::removeListener() +{ + Link aLink( LINK(this,AnnotationManagerImpl,EventMultiplexerListener) ); + mrBase.GetEventMultiplexer()->RemoveEventListener( aLink ); +} + +// -------------------------------------------------------------------- + +IMPL_LINK(AnnotationManagerImpl,EventMultiplexerListener, + tools::EventMultiplexerEvent*,pEvent) +{ + switch (pEvent->meEventId) + { + case tools::EventMultiplexerEvent::EID_CURRENT_PAGE: + case tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION: + onSelectionChanged(); + break; + + case tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED: + mxView = Reference(); + onSelectionChanged(); + break; + + case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED: + mxView = Reference::query( mrBase.GetController() ); + onSelectionChanged(); + break; + } + return 0; +} + +OUString AnnotationManagerImpl::GetHelpText( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation ) +{ + OUString sRet; + if( xAnnotation.is() ) + { + OUString sAuthor( xAnnotation->getAuthor() ); + if( sAuthor.getLength() != 0 ) + { + sRet += sAuthor; + } + sRet += OUString( RTL_CONSTASCII_USTRINGPARAM( " [" ) ); + + sRet += getAnnotationDateTimeString( xAnnotation ); + sRet += OUString( RTL_CONSTASCII_USTRINGPARAM( "]\n" ) ); + + Reference< XText > xText( xAnnotation->getTextRange() ); + if( xText.is() ) + sRet += xText->getString(); + } + + return sRet; +} + + +void AnnotationManagerImpl::ExecuteAnnotationContextMenu( Reference< XAnnotation > xAnnotation, ::Window* pParent, const Rectangle& rContextRect, bool bButtonMenu /* = false */ ) +{ + SfxDispatcher* pDispatcher( getDispatcher( mrBase ) ); + if( !pDispatcher ) + return; + + const bool bReadOnly = mrBase.GetDocShell()->IsReadOnly(); + + AnnotationWindow* pAnnotationWindow = bButtonMenu ? 0 : dynamic_cast< AnnotationWindow* >( pParent ); + + if( bReadOnly && !pAnnotationWindow ) + return; + + std::auto_ptr< PopupMenu > pMenu( new PopupMenu( SdResId( pAnnotationWindow ? RID_ANNOTATION_CONTEXTMENU : RID_ANNOTATION_TAG_CONTEXTMENU ) ) ); + + SvtUserOptions aUserOptions; + OUString sCurrentAuthor( aUserOptions.GetFullName() ); + OUString sAuthor( xAnnotation->getAuthor() ); + + String aStr( pMenu->GetItemText( SID_DELETEALLBYAUTHOR_POSTIT ) ), aReplace( sAuthor ); + if( aReplace.Len() == 0 ) + aReplace = String( SdResId( STR_ANNOTATION_NOAUTHOR ) ); + aStr.SearchAndReplaceAscii("%1", aReplace); + pMenu->SetItemText( SID_DELETEALLBYAUTHOR_POSTIT, aStr ); + pMenu->EnableItem( SID_REPLYTO_POSTIT, (sAuthor != sCurrentAuthor) && !bReadOnly ); + pMenu->EnableItem( SID_DELETE_POSTIT, (xAnnotation.is() && !bReadOnly) ? TRUE : FALSE ); + pMenu->EnableItem( SID_DELETEALLBYAUTHOR_POSTIT, !bReadOnly ); + pMenu->EnableItem( SID_DELETEALL_POSTIT, !bReadOnly ); + + if( pAnnotationWindow ) + { + if( pAnnotationWindow->IsProtected() || bReadOnly ) + { + pMenu->EnableItem( SID_ATTR_CHAR_WEIGHT, FALSE ); + pMenu->EnableItem( SID_ATTR_CHAR_POSTURE, FALSE ); + pMenu->EnableItem( SID_ATTR_CHAR_UNDERLINE, FALSE ); + pMenu->EnableItem( SID_ATTR_CHAR_STRIKEOUT, FALSE ); + pMenu->EnableItem( SID_PASTE, FALSE ); + } + else + { + SfxItemSet aSet(pAnnotationWindow->getView()->GetAttribs()); + + if ( aSet.GetItemState( EE_CHAR_WEIGHT ) == SFX_ITEM_ON ) + { + if( ((const SvxWeightItem&)aSet.Get( EE_CHAR_WEIGHT )).GetWeight() == WEIGHT_BOLD ) + pMenu->CheckItem( SID_ATTR_CHAR_WEIGHT ); + } + + if ( aSet.GetItemState( EE_CHAR_ITALIC ) == SFX_ITEM_ON ) + { + if( ((const SvxPostureItem&)aSet.Get( EE_CHAR_ITALIC )).GetPosture() != ITALIC_NONE ) + pMenu->CheckItem( SID_ATTR_CHAR_POSTURE ); + + } + if ( aSet.GetItemState( EE_CHAR_UNDERLINE ) == SFX_ITEM_ON ) + { + if( ((const SvxUnderlineItem&)aSet.Get( EE_CHAR_UNDERLINE )).GetLineStyle() != UNDERLINE_NONE ) + pMenu->CheckItem( SID_ATTR_CHAR_UNDERLINE ); + } + + if ( aSet.GetItemState( EE_CHAR_STRIKEOUT ) == SFX_ITEM_ON ) + { + if( ((const SvxCrossedOutItem&)aSet.Get( EE_CHAR_STRIKEOUT )).GetStrikeout() != STRIKEOUT_NONE ) + pMenu->CheckItem( SID_ATTR_CHAR_STRIKEOUT ); + } + TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pAnnotationWindow ) ); + pMenu->EnableItem( SID_PASTE, aDataHelper.GetFormatCount() != 0 ); + } + + pMenu->EnableItem( SID_COPY, pAnnotationWindow->getView()->HasSelection() ); + } + + USHORT nId = 0; + + // set slot images + Reference< ::com::sun::star::frame::XFrame > xFrame( mrBase.GetMainViewShell()->GetViewFrame()->GetFrame()->GetFrameInterface() ); + if( xFrame.is() ) + { + const bool bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); + for( USHORT nPos = 0; nPos < pMenu->GetItemCount(); nPos++ ) + { + nId = pMenu->GetItemId( nPos ); + if( pMenu->IsItemEnabled( nId ) ) + { + OUString sSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" )); + sSlotURL += OUString::valueOf( sal_Int32( nId )); + + Image aImage( GetImage( xFrame, sSlotURL, false, bHighContrast ) ); + if( !!aImage ) + pMenu->SetItemImage( nId, aImage ); + } + } + } + + nId = pMenu->Execute( pParent, rContextRect, POPUPMENU_EXECUTE_DOWN ); + switch( nId ) + { + case SID_REPLYTO_POSTIT: + { + const SfxUnoAnyItem aItem( SID_REPLYTO_POSTIT, Any( xAnnotation ) ); + pDispatcher->Execute( SID_REPLYTO_POSTIT, SFX_CALLMODE_ASYNCHRON, &aItem, 0 ); + break; + } + case SID_DELETE_POSTIT: + { + const SfxUnoAnyItem aItem( SID_DELETE_POSTIT, Any( xAnnotation ) ); + pDispatcher->Execute( SID_DELETE_POSTIT, SFX_CALLMODE_ASYNCHRON, &aItem, 0 ); + break; + } + case SID_DELETEALLBYAUTHOR_POSTIT: + { + const SfxStringItem aItem( SID_DELETEALLBYAUTHOR_POSTIT, sAuthor ); + pDispatcher->Execute( SID_DELETEALLBYAUTHOR_POSTIT, SFX_CALLMODE_ASYNCHRON, &aItem, 0 ); + break; + } + case SID_DELETEALL_POSTIT: + pDispatcher->Execute( SID_DELETEALL_POSTIT ); + break; + case SID_COPY: + case SID_PASTE: + case SID_ATTR_CHAR_WEIGHT: + case SID_ATTR_CHAR_POSTURE: + case SID_ATTR_CHAR_UNDERLINE: + case SID_ATTR_CHAR_STRIKEOUT: + if( pAnnotationWindow ) + pAnnotationWindow->ExecuteSlot( nId ); + break; + } +} + +// ==================================================================== + +Color AnnotationManagerImpl::GetColor(sal_uInt16 aAuthorIndex) +{ + if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode()) + { + static const Color aArrayNormal[] = { + COL_AUTHOR1_NORMAL, COL_AUTHOR2_NORMAL, COL_AUTHOR3_NORMAL, + COL_AUTHOR4_NORMAL, COL_AUTHOR5_NORMAL, COL_AUTHOR6_NORMAL, + COL_AUTHOR7_NORMAL, COL_AUTHOR8_NORMAL, COL_AUTHOR9_NORMAL }; + + return Color( aArrayNormal[ aAuthorIndex % (sizeof( aArrayNormal )/ sizeof( aArrayNormal[0] ))]); + } + else + return Color(COL_WHITE); +} + +Color AnnotationManagerImpl::GetColorLight(sal_uInt16 aAuthorIndex) +{ + if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode()) + { + static const Color aArrayLight[] = { + COL_AUTHOR1_LIGHT, COL_AUTHOR2_LIGHT, COL_AUTHOR3_LIGHT, + COL_AUTHOR4_LIGHT, COL_AUTHOR5_LIGHT, COL_AUTHOR6_LIGHT, + COL_AUTHOR7_LIGHT, COL_AUTHOR8_LIGHT, COL_AUTHOR9_LIGHT }; + + return Color( aArrayLight[ aAuthorIndex % (sizeof( aArrayLight )/ sizeof( aArrayLight[0] ))]); + } + else + return Color(COL_WHITE); +} + +Color AnnotationManagerImpl::GetColorDark(sal_uInt16 aAuthorIndex) +{ + if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode()) + { + static const Color aArrayAnkor[] = { + COL_AUTHOR1_DARK, COL_AUTHOR2_DARK, COL_AUTHOR3_DARK, + COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK, + COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK }; + + return Color( aArrayAnkor[ aAuthorIndex % (sizeof( aArrayAnkor ) / sizeof( aArrayAnkor[0] ))]); + } + else + return Color(COL_WHITE); +} + +SdPage* AnnotationManagerImpl::GetNextPage( SdPage* pPage, bool bForeward ) +{ + if( pPage == 0 ) + return bForeward ? GetFirstPage() : GetLastPage(); + + sal_uInt16 nPageNum = (pPage->GetPageNum() - 1) >> 1; + + // first all non master pages + if( !pPage->IsMasterPage() ) + { + if( bForeward ) + { + if( nPageNum >= mpDoc->GetSdPageCount(PK_STANDARD)-1 ) + { + // we reached end of draw pages, start with master pages (skip handout master for draw) + return mpDoc->GetMasterSdPage( (mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) ? 0 : 1, PK_STANDARD ); + } + nPageNum++; + } + else + { + if( nPageNum == 0 ) + return 0; // we are already on the first draw page, finished + + nPageNum--; + } + return mpDoc->GetSdPage(nPageNum, PK_STANDARD); + } + else + { + if( bForeward ) + { + if( nPageNum >= mpDoc->GetMasterSdPageCount(PK_STANDARD)-1 ) + { + return 0; // we reached the end, there is nothing more to see here + } + nPageNum++; + } + else + { + if( nPageNum == (mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) ? 0 : 1 ) + { + // we reached beginning of master pages, start with end if pages + return mpDoc->GetSdPage( mpDoc->GetSdPageCount(PK_STANDARD)-1, PK_STANDARD ); + } + + nPageNum--; + } + return static_cast< SdPage* >( mpDoc->GetMasterPage(nPageNum) ); + } +} + +SdPage* AnnotationManagerImpl::GetFirstPage() +{ + // return first drawing page + return mpDoc->GetSdPage(0, PK_STANDARD ); +} + +SdPage* AnnotationManagerImpl::GetLastPage() +{ + return mpDoc->GetMasterSdPage( mpDoc->GetMasterSdPageCount(PK_STANDARD) - 1, PK_STANDARD ); +} + +SdPage* AnnotationManagerImpl::GetCurrentPage() +{ +/* + ::boost::shared_ptr pDrawViewShell(::boost::dynamic_pointer_cast(mrBase.GetMainViewShell())); + if (pDrawViewShell.get() != NULL) + return pDrawViewShell->GetActualPage(); +*/ + return mrBase.GetMainViewShell()->getCurrentPage(); +} + +// ==================================================================== + +AnnotationManager::AnnotationManager( ViewShellBase& rViewShellBase ) +: mxImpl( new AnnotationManagerImpl( rViewShellBase ) ) +{ + mxImpl->init(); +} + +AnnotationManager::~AnnotationManager() +{ + mxImpl->dispose(); +} + +void AnnotationManager::ExecuteAnnotation(SfxRequest& rRequest) +{ + mxImpl->ExecuteAnnotation( rRequest ); +} + +void AnnotationManager::GetAnnotationState(SfxItemSet& rItemSet) +{ + mxImpl->GetAnnotationState(rItemSet); +} + +} diff --git a/sd/source/ui/annotations/annotationmanagerimpl.hxx b/sd/source/ui/annotations/annotationmanagerimpl.hxx new file mode 100755 index 000000000000..a64421c26262 --- /dev/null +++ b/sd/source/ui/annotations/annotationmanagerimpl.hxx @@ -0,0 +1,144 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AnnotationPanel.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SD_ANNOTATIONMANAGER_IMPL_HXX +#define _SD_ANNOTATIONMANAGER_IMPL_HXX + +#include +#include + +#include + +#include +#include + +#include "ViewShellBase.hxx" + +#include "annotationtag.hxx" + +class SfxRequest; + +namespace sd +{ + +typedef std::vector< rtl::Reference< AnnotationTag > > AnnotationTagVector; + +namespace tools { +class EventMultiplexerEvent; +} + +typedef ::cppu::WeakComponentImplHelper1 < + com::sun::star::document::XEventListener + > AnnotationManagerImplBase; + +class AnnotationManagerImpl : private ::cppu::BaseMutex, public AnnotationManagerImplBase +{ +public: + AnnotationManagerImpl( ViewShellBase& rViewShellBase ); + + void init(); + + // WeakComponentImplHelper1 + virtual void SAL_CALL disposing (); + + // XEventListener + virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + + // + void ExecuteAnnotation (SfxRequest& rRequest); + void GetAnnotationState (SfxItemSet& rItemSet); + + void ExecuteInsertAnnotation(SfxRequest& rReq); + void ExecuteDeleteAnnotation(SfxRequest& rReq); + void ExecuteReplyToAnnotation(SfxRequest& rReq); + + void SelectNextAnnotation(bool bForeward); + + void SelectAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > xAnnotation, bool bEdit = FALSE ); + void GetSelectedAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation ); + + void InsertAnnotation(); + void DeleteAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > xAnnotation ); + void DeleteAnnotationsByAuthor( const rtl::OUString& sAuthor ); + void DeleteAllAnnotations(); + + void ExecuteAnnotationContextMenu( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > xAnnotation, ::Window* pParent, const Rectangle& rContextRect, bool bButtonMenu = false ); + + Color GetColorDark(sal_uInt16 aAuthorIndex); + Color GetColorLight(sal_uInt16 aAuthorIndex); + Color GetColor(sal_uInt16 aAuthorIndex); + + + // callbacks + void onTagSelected( AnnotationTag& rTag ); + void onTagDeselected( AnnotationTag& rTag ); + + void onSelectionChanged(); + + rtl::OUString GetHelpText( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation ); + + void addListener(); + void removeListener(); + + void invalidateSlots(); + + DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*); + DECL_LINK(UpdateTagsHdl, void *); + + void UpdateTags(bool bSynchron = false); + void CreateTags(); + void DisposeTags(); + + SdPage* GetNextPage( SdPage* pPage, bool bForeward ); + SdPage* GetFirstPage(); + SdPage* GetLastPage(); + + SdPage* GetCurrentPage(); + + SdDrawDocument* GetDoc() { return mpDoc; } +private: + ViewShellBase& mrBase; + SdDrawDocument* mpDoc; + + AnnotationTagVector maTagVector; + + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView; + ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotationAccess > mxCurrentPage; + ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxSelectedAnnotation; + + bool mbShowAnnotations; + ULONG mnUpdateTagsEvent; + Font maFont; +}; + +} + +#endif // _SD_ANNOTATIONMANAGER_IMPL_HXX diff --git a/sd/source/ui/annotations/annotations.hrc b/sd/source/ui/annotations/annotations.hrc new file mode 100644 index 000000000000..0688fb0fa195 --- /dev/null +++ b/sd/source/ui/annotations/annotations.hrc @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: TableDesignPane.hrc,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SD_ANNOTATIONPANE_HRC +#define _SD_ANNOTATIONPANE_HRC + +#include "glob.hrc" + +// strings +#define STR_ANNOTATION_TODAY (RID_ANNOTATIONS_START+1) +#define STR_ANNOTATION_YESTERDAY (RID_ANNOTATIONS_START+2) +#define STR_ANNOTATION_NOAUTHOR (RID_ANNOTATIONS_START+3) +#define STR_ANNOTATION_WRAP_FORWARD (RID_ANNOTATIONS_START+4) +#define STR_ANNOTATION_WRAP_BACKWARD (RID_ANNOTATIONS_START+5) +#define STR_ANNOTATION_WRAP_FORWARD_DRAW (RID_ANNOTATIONS_START+6) +#define STR_ANNOTATION_WRAP_BACKWARD_DRAW (RID_ANNOTATIONS_START+7) +#define STR_ANNOTATION_UNDO_INSERT (RID_ANNOTATIONS_START+8) +#define STR_ANNOTATION_UNDO_DELETE (RID_ANNOTATIONS_START+9) +#define STR_ANNOTATION_UNDO_MOVE (RID_ANNOTATIONS_START+10) +#define STR_ANNOTATION_UNDO_EDIT (RID_ANNOTATIONS_START+11) +#define STR_ANNOTATION_UNDO_REPLY (RID_ANNOTATIONS_START+12) +#define STR_ANNOTATION_REPLY (RID_ANNOTATIONS_START+13) + +// menus +#define RID_ANNOTATION_CONTEXTMENU (RID_ANNOTATIONS_START+0) +#define RID_ANNOTATION_TAG_CONTEXTMENU (RID_ANNOTATIONS_START+1) + +#define BTN_NEW 1 +#define BTN_DELETE 2 +#define BTN_NEXT 3 +#define BTN_PREV 4 + +#define TBX_TOOLBAR 1 +#define FT_AUTHOR 1 +#define ED_AUTHOR 2 +#define FT_DATE 3 +#define ED_DATE 4 + +#define CT_TEXT 5 + +#endif // _SD_ANNOTATIONPANE_HRC diff --git a/sd/source/ui/annotations/annotations.src b/sd/source/ui/annotations/annotations.src new file mode 100644 index 000000000000..ab6311425fc7 --- /dev/null +++ b/sd/source/ui/annotations/annotations.src @@ -0,0 +1,212 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "annotations.hrc" +#include "glob.hrc" +#include + +Menu RID_ANNOTATION_CONTEXTMENU +{ + ItemList = + { + MenuItem + { + Identifier = SID_REPLYTO_POSTIT; + HelpID = SID_REPLYTO_POSTIT ; + Text [ en-US ] = "~Reply"; + }; + MenuItem + { + Separator = TRUE; + }; + MenuItem + { + Identifier = SID_ATTR_CHAR_WEIGHT; + HelpID = SID_ATTR_CHAR_WEIGHT ; + Text [ en-US ] = "~Bold"; + }; + MenuItem + { + Identifier = SID_ATTR_CHAR_POSTURE; + HelpID = SID_ATTR_CHAR_POSTURE; + Text [ en-US ] = "~Italic"; + }; + MenuItem + { + Identifier = SID_ATTR_CHAR_UNDERLINE; + HelpID = SID_ATTR_CHAR_UNDERLINE; + Text [ en-US ] = "~Underline"; + }; + MenuItem + { + Identifier = SID_ATTR_CHAR_STRIKEOUT; + HelpID = SID_ATTR_CHAR_STRIKEOUT; + Text [ en-US ] = "~Strikethrough"; + }; + MenuItem + { + Separator = TRUE; + }; + MenuItem + { + Identifier = SID_COPY ; + HelpID = SID_COPY ; + Text [ en-US ] = "~Copy" ; + }; + MenuItem + { + Identifier = SID_PASTE ; + HelpID = SID_PASTE ; + Text [ en-US ] = "~Paste" ; + }; + MenuItem + { + Separator = TRUE; + }; + MenuItem + { + Identifier = SID_DELETE_POSTIT ; + HelpID = SID_DELETE_POSTIT; + Text [ en-US ] = "~Delete Comment" ; + }; + MenuItem + { + Identifier = SID_DELETEALLBYAUTHOR_POSTIT ; + HelpID = SID_DELETEALLBYAUTHOR_POSTIT; + Text [ en-US ] = "Delete All Comments b~y %1" ; + }; + MenuItem + { + Identifier = SID_DELETEALL_POSTIT; + HelpID = SID_DELETEALL_POSTIT; + Text [ en-US ] = "Delete ~All Comments" ; + }; + }; +}; + +Menu RID_ANNOTATION_TAG_CONTEXTMENU +{ + ItemList = + { + MenuItem + { + Identifier = SID_REPLYTO_POSTIT; + HelpID = SID_REPLYTO_POSTIT; + Text [ en-US ] = "~Reply"; + }; + MenuItem + { + Separator = TRUE; + }; + MenuItem + { + Identifier = SID_DELETE_POSTIT ; + HelpID = SID_DELETE_POSTIT ; + Text [ en-US ] = "~Delete Comment" ; + }; + MenuItem + { + Identifier = SID_DELETEALLBYAUTHOR_POSTIT ; + HelpID = SID_DELETEALLBYAUTHOR_POSTIT ; + Text [ en-US ] = "Delete All Comments ~by %1" ; + }; + MenuItem + { + Identifier = SID_DELETEALL_POSTIT; + HelpID = SID_DELETEALL_POSTIT; + Text [ en-US ] = "Delete ~All Comments" ; + }; + }; +}; + +String STR_ANNOTATION_TODAY +{ + Text [ en-US ] = "Today," ; +}; + +String STR_ANNOTATION_YESTERDAY +{ + Text [ en-US ] = "Yesterday," ; +}; + +String STR_ANNOTATION_NOAUTHOR +{ + Text [ en-US ] = "(no author)" ; +}; + +String STR_ANNOTATION_WRAP_FORWARD +{ + Text [ en-US ] = "%PRODUCTNAME Impress reached the end of the presentation. Do you want to continue at the beginning?"; +}; + +String STR_ANNOTATION_WRAP_BACKWARD +{ + Text [ en-US ] = "%PRODUCTNAME Impress reached the beginning of the presentation. Do you want to continue at the end?"; +}; + +String STR_ANNOTATION_WRAP_FORWARD_DRAW +{ + Text [ en-US ] = "%PRODUCTNAME Draw reached the end of the document. Do you want to continue at the beginning?"; +}; + +String STR_ANNOTATION_WRAP_BACKWARD_DRAW +{ + Text [ en-US ] = "%PRODUCTNAME Draw reached the beginning of the document. Do you want to continue at the end?"; +}; + +String STR_ANNOTATION_UNDO_INSERT +{ + Text [ en-US ] = "Insert Comment"; +}; + +String STR_ANNOTATION_UNDO_DELETE +{ + Text [ en-US ] = "Delete Comment(s)"; +}; + +String STR_ANNOTATION_UNDO_MOVE +{ + Text [ en-US ] = "Move Comment"; +}; + +String STR_ANNOTATION_UNDO_EDIT +{ + Text [ en-US ] = "Edit Comment"; +}; + +String STR_ANNOTATION_UNDO_REPLY +{ + Text [ en-US ] = "Reply to Comment"; +}; + +String STR_ANNOTATION_REPLY +{ + Text [ en-US ] = "Reply to %1" ; +}; diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx new file mode 100644 index 000000000000..af219c3aadc3 --- /dev/null +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -0,0 +1,792 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: motionpathtag.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "View.hxx" +#include "sdresid.hxx" +#include "annotations.hrc" +#include "annotationmanagerimpl.hxx" +#include "annotationwindow.hxx" +#include "annotationtag.hxx" +#include "sdpage.hxx" +#include "ViewShell.hxx" +#include "app.hrc" +#include "Window.hxx" +#include "drawdoc.hxx" + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +//using namespace ::com::sun::star::util; +using namespace ::com::sun::star::drawing; +using namespace ::com::sun::star::office; +using namespace ::com::sun::star::geometry; + +namespace sd +{ + +const sal_uInt32 SMART_TAG_HDL_NUM = SAL_MAX_UINT32; +static const int DRGPIX = 2; // Drag MinMove in Pixel + +// -------------------------------------------------------------------- + +static OUString getInitials( const OUString& rName ) +{ + OUString sInitials; + + const sal_Unicode * pStr = rName.getStr(); + sal_Int32 nLength = rName.getLength(); + + while( nLength ) + { + // skip whitespace + while( nLength && (*pStr <= ' ') ) + { + nLength--; pStr++; + } + + // take letter + if( nLength ) + { + sInitials += OUString( *pStr ); + nLength--; pStr++; + } + + // skip letters until whitespace + while( nLength && (*pStr > ' ') ) + { + nLength--; pStr++; + } + } + + return sInitials; +} + +// -------------------------------------------------------------------- + +// -------------------------------------------------------------------- + +class AnnotationDragMove : public SdrDragMove +{ +public: + AnnotationDragMove(SdrDragView& rNewView, const rtl::Reference & xTag); + virtual bool BeginSdrDrag(); + virtual bool EndSdrDrag(bool bCopy); + virtual void MoveSdrDrag(const Point& rNoSnapPnt); + virtual void CancelSdrDrag(); + +private: + rtl::Reference mxTag; + Point maOrigin; +}; + +AnnotationDragMove::AnnotationDragMove(SdrDragView& rNewView, const rtl::Reference & xTag) +: SdrDragMove(rNewView) +, mxTag( xTag ) +{ +} + +bool AnnotationDragMove::BeginSdrDrag() +{ + DragStat().Ref1()=GetDragHdl()->GetPos(); + DragStat().SetShown(!DragStat().IsShown()); + + maOrigin = GetDragHdl()->GetPos(); + DragStat().SetActionRect(Rectangle(maOrigin,maOrigin)); + + return true; +} + +void AnnotationDragMove::MoveSdrDrag(const Point& rNoSnapPnt) +{ + Point aPnt(rNoSnapPnt); + + if (DragStat().CheckMinMoved(rNoSnapPnt)) + { + if (aPnt!=DragStat().GetNow()) + { + Hide(); + DragStat().NextMove(aPnt); + GetDragHdl()->SetPos( maOrigin + Point( DragStat().GetDX(), DragStat().GetDY() ) ); + Show(); + DragStat().SetActionRect(Rectangle(aPnt,aPnt)); + } + } +} + +bool AnnotationDragMove::EndSdrDrag(bool /*bCopy*/) +{ + Hide(); + if( mxTag.is() ) + mxTag->Move( DragStat().GetDX(), DragStat().GetDY() ); + return TRUE; +} + +void AnnotationDragMove::CancelSdrDrag() +{ + Hide(); +} + +// -------------------------------------------------------------------- + +class AnnotationHdl : public SmartHdl +{ +public: + AnnotationHdl( const SmartTagReference& xTag, const Reference< XAnnotation >& xAnnotation, const Point& rPnt ); + virtual ~AnnotationHdl(); + virtual void CreateB2dIAObject(); + virtual BOOL IsFocusHdl() const; + virtual Pointer GetSdrDragPointer() const; + virtual bool isMarkable() const; + + +private: + Reference< XAnnotation > mxAnnotation; + rtl::Reference< AnnotationTag > mxTag; +}; + +// -------------------------------------------------------------------- + +AnnotationHdl::AnnotationHdl( const SmartTagReference& xTag, const Reference< XAnnotation >& xAnnotation, const Point& rPnt ) +: SmartHdl( xTag, rPnt ) +, mxAnnotation( xAnnotation ) +, mxTag( dynamic_cast< AnnotationTag* >( xTag.get() ) ) +{ +} + +// -------------------------------------------------------------------- + +AnnotationHdl::~AnnotationHdl() +{ +} + +// -------------------------------------------------------------------- + +void AnnotationHdl::CreateB2dIAObject() +{ + // first throw away old one + GetRidOfIAObject(); + + if( mxAnnotation.is() ) + { + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + + const Point aTagPos( GetPos() ); + basegfx::B2DPoint aPosition( aTagPos.X(), aTagPos.Y() ); + + const bool bFocused = IsFocusHdl() && pHdlList && (pHdlList->GetFocusHdl() == this); + + BitmapEx aBitmapEx( mxTag->CreateAnnotationBitmap(mxTag->isSelected()) ); + BitmapEx aBitmapEx2; + if( bFocused ) + aBitmapEx2 = mxTag->CreateAnnotationBitmap(!mxTag->isSelected() ); + + if(pHdlList) + { + SdrMarkView* pView = pHdlList->GetView(); + + if(pView && !pView->areMarkHandlesHidden()) + { + SdrPageView* pPageView = pView->GetSdrPageView(); + + if(pPageView) + { + for(sal_uInt32 b = 0; b < pPageView->PageWindowCount(); b++) + { + // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b]; + const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b); + + SdrPaintWindow& rPaintWindow = rPageWindow.GetPaintWindow(); + if(rPaintWindow.OutputToWindow() && rPageWindow.GetOverlayManager() ) + { + ::sdr::overlay::OverlayObject* pOverlayObject = 0; + + // animate focused handles + if(bFocused) + { + const sal_uInt32 nBlinkTime = sal::static_int_cast(rStyleSettings.GetCursorBlinkTime()); + + pOverlayObject = new ::sdr::overlay::OverlayAnimatedBitmapEx(aPosition, aBitmapEx, aBitmapEx2, nBlinkTime, 0, 0, 0, 0 ); +/* + (UINT16)(aBitmapEx.GetSizePixel().Width() - 1) >> 1, + (UINT16)(aBitmapEx.GetSizePixel().Height() - 1) >> 1, + (UINT16)(aBitmapEx2.GetSizePixel().Width() - 1) >> 1, + (UINT16)(aBitmapEx2.GetSizePixel().Height() - 1) >> 1); +*/ + } + else + { + pOverlayObject = new ::sdr::overlay::OverlayBitmapEx( aPosition, aBitmapEx, 0, 0 ); + } + + rPageWindow.GetOverlayManager()->add(*pOverlayObject); + maOverlayGroup.append(*pOverlayObject); + } + } + } + } + } + } +} + +// -------------------------------------------------------------------- + +BOOL AnnotationHdl::IsFocusHdl() const +{ + return TRUE; +} + +// -------------------------------------------------------------------- + +bool AnnotationHdl::isMarkable() const +{ + return false; +} + +// -------------------------------------------------------------------- + +Pointer AnnotationHdl::GetSdrDragPointer() const +{ + PointerStyle eStyle = POINTER_NOTALLOWED; + if( mxTag.is() ) + { + if( mxTag->isSelected() ) + { + eStyle = POINTER_MOVE; + } + else + { + eStyle = POINTER_ARROW; + + } + } + return Pointer( eStyle ); +} + +// ==================================================================== + +AnnotationTag::AnnotationTag( AnnotationManagerImpl& rManager, ::sd::View& rView, const Reference< XAnnotation >& xAnnotation, Color& rColor, int nIndex, const Font& rFont ) +: SmartTag( rView ) +, mrManager( rManager ) +, mxAnnotation( xAnnotation ) +, maColor( rColor ) +, mnIndex( nIndex ) +, mrFont( rFont ) +, mnClosePopupEvent( 0 ) +, mpListenWindow( 0 ) +{ +} + +// -------------------------------------------------------------------- + +AnnotationTag::~AnnotationTag() +{ + DBG_ASSERT( !mxAnnotation.is(), "sd::AnnotationTag::~AnnotationTag(), dispose me first!" ); + Dispose(); +} + +// -------------------------------------------------------------------- + +/** returns true if the AnnotationTag handled the event. */ +bool AnnotationTag::MouseButtonDown( const MouseEvent& rMEvt, SmartHdl& /*rHdl*/ ) +{ + if( !mxAnnotation.is() ) + return false; + + bool bRet = false; + if( !isSelected() ) + { + SmartTagReference xTag( this ); + mrView.getSmartTags().select( xTag ); + bRet = true; + } + /* + if( rMEvt.IsLeft() && (rMEvt.GetClicks() == 2) ) + { + // double click; + return true; + } + else */ + if( rMEvt.IsLeft() && !rMEvt.IsRight() ) + { + Window* pWindow = mrView.GetViewShell()->GetActiveWindow(); + if( pWindow ) + { + maMouseDownPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() ); + + if( mpListenWindow ) + mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler)); + + mpListenWindow = pWindow; + mpListenWindow->AddEventListener( LINK(this, AnnotationTag, WindowEventHandler)); + } + + bRet = true; + } + + return bRet; +} + +// -------------------------------------------------------------------- + +/** returns true if the SmartTag consumes this event. */ +bool AnnotationTag::KeyInput( const KeyEvent& rKEvt ) +{ + if( !mxAnnotation.is() ) + return false; + + USHORT nCode = rKEvt.GetKeyCode().GetCode(); + switch( nCode ) + { + case KEY_DELETE: + mrManager.DeleteAnnotation( mxAnnotation ); + return true; + + case KEY_DOWN: + case KEY_UP: + case KEY_LEFT: + case KEY_RIGHT: + return OnMove( rKEvt ); + + case KEY_ESCAPE: + { + SmartTagReference xThis( this ); + mrView.getSmartTags().deselect(); + return true; + } + + case KEY_TAB: + mrManager.SelectNextAnnotation(!rKEvt.GetKeyCode().IsShift()); + return true; + + case KEY_RETURN: + case KEY_SPACE: + OpenPopup( true ); + return true; + + default: + return false; + } +} + +/** returns true if the SmartTag consumes this event. */ +bool AnnotationTag::RequestHelp( const HelpEvent& /*rHEvt*/ ) +{ +/* + ::Window* pWindow = mrView.GetViewShell()->GetActiveWindow(); + if( mxAnnotation.is() && pWindow ) + { + OUString aHelpText( mrManager.GetHelpText( mxAnnotation ) ); + + RealPoint2D aPosition( mxAnnotation->getPosition() ); + Point aPos( pWindow->LogicToPixel( Point( static_cast(aPosition.X * 100.0), static_cast(aPosition.Y * 100.0) ) ) ); + + Rectangle aRect( aPos, maSize ); + + if (Help::IsBalloonHelpEnabled()) + Help::ShowBalloon( pWindow, aPos, aRect, aHelpText); + else if (Help::IsQuickHelpEnabled()) + Help::ShowQuickHelp( pWindow, aRect, aHelpText); + + return true; + } +*/ + return false; +} + +/** returns true if the SmartTag consumes this event. */ +bool AnnotationTag::Command( const CommandEvent& rCEvt ) +{ + if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) + { + ::Window* pWindow = mrView.GetViewShell()->GetActiveWindow(); + if( pWindow ) + { + Rectangle aContextRect(rCEvt.GetMousePosPixel(),Size(1,1)); + mrManager.ExecuteAnnotationContextMenu( mxAnnotation, pWindow, aContextRect ); + return true; + } + } + + return false; +} + +void AnnotationTag::Move( int nDX, int nDY ) +{ + if( mxAnnotation.is() ) + { + if( mrManager.GetDoc()->IsUndoEnabled() ) + mrManager.GetDoc()->BegUndo( String( SdResId( STR_ANNOTATION_UNDO_MOVE ) ) ); + + RealPoint2D aPosition( mxAnnotation->getPosition() ); + aPosition.X += (double)nDX / 100.0; + aPosition.Y += (double)nDY / 100.0; + mxAnnotation->setPosition( aPosition ); + + if( mrManager.GetDoc()->IsUndoEnabled() ) + mrManager.GetDoc()->EndUndo(); + + mrView.updateHandles(); + } +} + +bool AnnotationTag::OnMove( const KeyEvent& rKEvt ) +{ + long nX = 0; + long nY = 0; + + switch( rKEvt.GetKeyCode().GetCode() ) + { + case KEY_UP: nY = -1; break; + case KEY_DOWN: nY = 1; break; + case KEY_LEFT: nX = -1; break; + case KEY_RIGHT: nX = 1; break; + default: break; + } + + if(rKEvt.GetKeyCode().IsMod2()) + { + OutputDevice* pOut = mrView.GetViewShell()->GetActiveWindow(); + Size aLogicSizeOnePixel = (pOut) ? pOut->PixelToLogic(Size(1,1)) : Size(100, 100); + nX *= aLogicSizeOnePixel.Width(); + nY *= aLogicSizeOnePixel.Height(); + } + else + { + // old, fixed move distance + nX *= 100; + nY *= 100; + } + + if( nX || nY ) + { + // move the annotation + Move( nX, nY ); + } + + return true; +} + +// -------------------------------------------------------------------- + +void AnnotationTag::CheckPossibilities() +{ +} + +// -------------------------------------------------------------------- + +ULONG AnnotationTag::GetMarkablePointCount() const +{ + return 0; +} + +// -------------------------------------------------------------------- + +ULONG AnnotationTag::GetMarkedPointCount() const +{ + return 0; +} + +// -------------------------------------------------------------------- + +BOOL AnnotationTag::MarkPoint(SdrHdl& /*rHdl*/, BOOL /*bUnmark*/ ) +{ + BOOL bRet=FALSE; + return bRet; +} + +// -------------------------------------------------------------------- + +BOOL AnnotationTag::MarkPoints(const Rectangle* /*pRect*/, BOOL /*bUnmark*/ ) +{ + BOOL bChgd=FALSE; + return bChgd; +} + +// -------------------------------------------------------------------- + +bool AnnotationTag::getContext( SdrViewContext& /*rContext*/ ) +{ + return false; +} + +// -------------------------------------------------------------------- + +void AnnotationTag::addCustomHandles( SdrHdlList& rHandlerList ) +{ + if( mxAnnotation.is() ) + { + SmartTagReference xThis( this ); + Point aPoint; + AnnotationHdl* pHdl = new AnnotationHdl( xThis, mxAnnotation, aPoint ); + pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM ); + pHdl->SetPageView( mrView.GetSdrPageView() ); + + RealPoint2D aPosition( mxAnnotation->getPosition() ); + Point aBasePos( static_cast(aPosition.X * 100.0), static_cast(aPosition.Y * 100.0) ); + pHdl->SetPos( aBasePos ); + + rHandlerList.AddHdl( pHdl ); + } +} + +// -------------------------------------------------------------------- + +void AnnotationTag::disposing() +{ + if( mpListenWindow ) + { + mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler)); + } + + if( mnClosePopupEvent ) + { + Application::RemoveUserEvent( mnClosePopupEvent ); + mnClosePopupEvent = 0; + } + + mxAnnotation.clear(); + ClosePopup(); + SmartTag::disposing(); +} + +// -------------------------------------------------------------------- + +void AnnotationTag::select() +{ + SmartTag::select(); + + mrManager.onTagSelected( *this ); + + Window* pWindow = mrView.GetViewShell()->GetActiveWindow(); + if( pWindow ) + { + RealPoint2D aPosition( mxAnnotation->getPosition() ); + Point aPos( static_cast(aPosition.X * 100.0), static_cast(aPosition.Y * 100.0) ); + + Rectangle aVisRect( aPos, pWindow->PixelToLogic(maSize) ); + mrView.MakeVisible(aVisRect, *pWindow); + } +} + +// -------------------------------------------------------------------- + +void AnnotationTag::deselect() +{ + SmartTag::deselect(); + + ClosePopup(); + + mrManager.onTagDeselected( *this ); +} + +// -------------------------------------------------------------------- + +BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected ) +{ + VirtualDevice aVDev; + + OUString sAuthor( getInitials( mxAnnotation->getAuthor() ) ); + sAuthor += OUString( sal_Unicode( ' ' ) ); + sAuthor += OUString::valueOf( (sal_Int32)mnIndex ); + + aVDev.SetFont( mrFont ); + + const int BORDER_X = 4; // pixels + const int BORDER_Y = 4; // pixels + + maSize = Size( aVDev.GetTextWidth( sAuthor ) + 2*BORDER_X, aVDev.GetTextHeight() + 2*BORDER_Y ); + aVDev.SetOutputSizePixel( maSize, FALSE ); + + Color aBorderColor( maColor ); + + if( bSelected ) + { + aBorderColor.Invert(); + } + else + { + if( maColor.IsDark() ) + { + aBorderColor.IncreaseLuminance( 32 ); + } + else + { + aBorderColor.DecreaseLuminance( 32 ); + } + } + + Point aPos; + Rectangle aBorderRect( aPos, maSize ); + aVDev.SetLineColor(aBorderColor); + aVDev.SetFillColor(maColor); + aVDev.DrawRect( aBorderRect ); + + aVDev.SetTextColor( maColor.IsDark() ? COL_WHITE : COL_BLACK ); + aVDev.DrawText( Point( BORDER_X, BORDER_Y ), sAuthor ); + + return aVDev.GetBitmapEx( aPos, maSize ); +} + +void AnnotationTag::OpenPopup( bool bEdit ) +{ + if( !mxAnnotation.is() ) + return; + + if( !mpAnnotationWindow.get() ) + { + ::Window* pWindow = dynamic_cast< ::Window* >( getView().GetFirstOutputDevice() ); + if( pWindow ) + { + RealPoint2D aPosition( mxAnnotation->getPosition() ); + Point aPos( pWindow->OutputToScreenPixel( pWindow->LogicToPixel( Point( static_cast(aPosition.X * 100.0), static_cast(aPosition.Y * 100.0) ) ) ) ); + + aPos.X() += 4; // magic! + aPos.Y() += 1; + + Rectangle aRect( aPos, maSize ); + + mpAnnotationWindow.reset( new AnnotationWindow( mrManager, mrView.GetDocSh(), pWindow->GetWindow(WINDOW_FRAME) ) ); + mpAnnotationWindow->InitControls(); + mpAnnotationWindow->setAnnotation(mxAnnotation); + + USHORT nArrangeIndex = 0; + Point aPopupPos( FloatingWindow::CalcFloatingPosition( mpAnnotationWindow.get(), aRect, FLOATWIN_POPUPMODE_RIGHT, nArrangeIndex ) ); + Size aPopupSize( 320, 240 ); + + mpAnnotationWindow->SetPosSizePixel( aPopupPos, aPopupSize ); + mpAnnotationWindow->DoResize(); + + mpAnnotationWindow->Show(); + mpAnnotationWindow->GrabFocus(); + mpAnnotationWindow->AddEventListener( LINK(this, AnnotationTag, WindowEventHandler)); + } + } + + if( bEdit && mpAnnotationWindow.get() ) + mpAnnotationWindow->StartEdit(); +} + +void AnnotationTag::ClosePopup() +{ + if( mpAnnotationWindow.get() ) + { + mpAnnotationWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler)); + mpAnnotationWindow.reset(); + } +} + +IMPL_LINK(AnnotationTag, WindowEventHandler, VclWindowEvent*, pEvent) +{ + if( pEvent != NULL ) + { + ::Window* pWindow = pEvent->GetWindow(); + + if( pWindow ) + { + if( pWindow == mpAnnotationWindow.get() ) + { + if( pEvent->GetId() == VCLEVENT_WINDOW_DEACTIVATE ) + { + if( mnClosePopupEvent ) + Application::RemoveUserEvent( mnClosePopupEvent ); + + mnClosePopupEvent = Application::PostUserEvent( LINK( this, AnnotationTag, ClosePopupHdl ) ); + } + } + else if( pWindow == mpListenWindow ) + { + switch( pEvent->GetId() ) + { + case VCLEVENT_WINDOW_MOUSEBUTTONUP: + { + // if we stop pressing the button without a mouse move we open the popup + mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler)); + mpListenWindow = 0; + if( mpAnnotationWindow.get() == 0 ) + OpenPopup(false); + } + break; + case VCLEVENT_WINDOW_MOUSEMOVE: + { + // if we move the mouse after a button down we wan't to start draging + mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler)); + mpListenWindow = 0; + + SdrHdl* pHdl = mrView.PickHandle(maMouseDownPos); + if( pHdl ) + { + mrView.BrkAction(); + const USHORT nDrgLog = (USHORT)pWindow->PixelToLogic(Size(DRGPIX,0)).Width(); + + rtl::Reference< AnnotationTag > xTag( this ); + + SdrDragMethod* pDragMethod = new AnnotationDragMove( mrView, xTag ); + mrView.BegDragObj(maMouseDownPos, NULL, pHdl, nDrgLog, pDragMethod ); + } + } + break; + case VCLEVENT_OBJECT_DYING: + mpListenWindow = 0; + break; + } + } + } + } + return TRUE; +} + +IMPL_LINK( AnnotationTag, ClosePopupHdl, void *, EMPTYARG ) +{ + mnClosePopupEvent = 0; + ClosePopup(); + return 0; +} + +} // end of namespace sd + diff --git a/sd/source/ui/annotations/annotationtag.hxx b/sd/source/ui/annotations/annotationtag.hxx new file mode 100644 index 000000000000..cd21f363011f --- /dev/null +++ b/sd/source/ui/annotations/annotationtag.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: motionpathtag.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SD_ANNOTATIONTAG_HXX_ +#define _SD_ANNOTATIONTAG_HXX_ + +#include +#include +#include +#include "smarttag.hxx" + +namespace css = ::com::sun::star; + +namespace sd { + +class View; +class AnnotationManagerImpl; +class AnnotationWindow; + +class AnnotationTag : public SmartTag +{ +public: + AnnotationTag( AnnotationManagerImpl& rManager, ::sd::View& rView, const css::uno::Reference< css::office::XAnnotation >& xAnnotation, Color& rColor, int nIndex, const Font& rFont ); + virtual ~AnnotationTag(); + + /** returns true if the SmartTag handled the event. */ + virtual bool MouseButtonDown( const MouseEvent&, SmartHdl& ); + + /** returns true if the SmartTag consumes this event. */ + virtual bool KeyInput( const KeyEvent& rKEvt ); + + /** returns true if the SmartTag consumes this event. */ + virtual bool RequestHelp( const HelpEvent& rHEvt ); + + /** returns true if the SmartTag consumes this event. */ + virtual bool Command( const CommandEvent& rCEvt ); + + // callbacks from sdr view + virtual ULONG GetMarkablePointCount() const; + virtual ULONG GetMarkedPointCount() const; + virtual BOOL MarkPoint(SdrHdl& rHdl, BOOL bUnmark=FALSE); + virtual void CheckPossibilities(); + virtual BOOL MarkPoints(const Rectangle* pRect, BOOL bUnmark); + + void Move( int nDX, int nDY ); + bool OnMove( const KeyEvent& rKEvt ); + + // --- + + BitmapEx CreateAnnotationBitmap(bool); + + css::uno::Reference< css::office::XAnnotation > GetAnnotation() const { return mxAnnotation; } + + void OpenPopup( bool bEdit ); + void ClosePopup(); + +protected: + virtual void addCustomHandles( SdrHdlList& rHandlerList ); + virtual bool getContext( SdrViewContext& rContext ); + virtual void disposing(); + virtual void select(); + virtual void deselect(); + + DECL_LINK( WindowEventHandler, VclWindowEvent* ); + DECL_LINK( ClosePopupHdl, void* ); + +private: + AnnotationManagerImpl& mrManager; + css::uno::Reference< css::office::XAnnotation > mxAnnotation; + std::auto_ptr mpAnnotationWindow; + Color maColor; + int mnIndex; + const Font& mrFont; + Size maSize; + ULONG mnClosePopupEvent; + ::Window* mpListenWindow; + Point maMouseDownPos; +}; + +} // end of namespace sd + +#endif // _SD_ANNOTATIONTAG_HXX_ + diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx new file mode 100644 index 000000000000..ae3c65a2b4d5 --- /dev/null +++ b/sd/source/ui/annotations/annotationwindow.cxx @@ -0,0 +1,849 @@ +/************************************************************************* * + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: postit.cxx,v $ + * $Revision: 1.8.42.11 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_sd.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //EditEngine flags +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include // FRound +#include + +#include +#include +#include + +#include "annotations.hrc" +#include "annotationwindow.hxx" +#include "annotationmanagerimpl.hxx" + +#include "DrawDocShell.hxx" +#include "ViewShell.hxx" +#include "drawdoc.hxx" +#include "View.hxx" +#include "textapi.hxx" +#include "sdresid.hxx" + +using rtl::OUString; +using namespace ::sd; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::office; +using namespace ::com::sun::star::text; + +#define METABUTTON_WIDTH 16 +#define METABUTTON_HEIGHT 18 +#define METABUTTON_AREA_WIDTH 30 +#define POSTIT_META_HEIGHT (sal_Int32) 30 + +#define EMPTYSTRING rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")) + +namespace sd { + +extern OUString getAnnotationDateTimeString( const Reference< XAnnotation >& xAnnotation ); +extern SfxItemPool* GetAnnotationPool(); +extern com::sun::star::util::DateTime getCurrentDateTime(); + +Color ColorFromAlphaColor(UINT8 aTransparency, Color &aFront, Color &aBack ) +{ + return Color((UINT8)(aFront.GetRed() * aTransparency/(double)255 + aBack.GetRed() * (1-aTransparency/(double)255)), + (UINT8)(aFront.GetGreen() * aTransparency/(double)255 + aBack.GetGreen() * (1-aTransparency/(double)255)), + (UINT8)(aFront.GetBlue() * aTransparency/(double)255 + aBack.GetBlue() * (1-aTransparency/(double)255))); +} + +/************ AnnotationTextWindow **********************************/ + +AnnotationTextWindow::AnnotationTextWindow( AnnotationWindow* pParent, WinBits nBits ) +: Control(pParent, nBits) +, mpOutlinerView(0) +, mpAnnotationWindow( pParent ) +{ +} + +AnnotationTextWindow::~AnnotationTextWindow() +{ +} + +void AnnotationTextWindow::Paint( const Rectangle& rRect) +{ + if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) + { + DrawGradient(Rectangle(Point(0,0),PixelToLogic(GetSizePixel())), + Gradient(GRADIENT_LINEAR,mpAnnotationWindow->maColorLight,mpAnnotationWindow->maColor)); + } + + if( mpOutlinerView ) + mpOutlinerView->Paint( rRect ); +} + +void AnnotationTextWindow::KeyInput( const KeyEvent& rKeyEvt ) +{ + const KeyCode& rKeyCode = rKeyEvt.GetKeyCode(); + USHORT nKey = rKeyCode.GetCode(); + + if ((rKeyCode.IsMod1() && rKeyCode.IsMod2()) && ((nKey == KEY_PAGEUP) || (nKey == KEY_PAGEDOWN))) + { + SfxDispatcher* pDispatcher = mpAnnotationWindow->DocShell()->GetViewShell()->GetViewFrame()->GetDispatcher(); + if( pDispatcher ) + pDispatcher->Execute( nKey == KEY_PAGEDOWN ? SID_NEXT_POSTIT : SID_PREVIOUS_POSTIT ); + } + else if (nKey == KEY_INSERT) + { + if (!rKeyCode.IsMod1() && !rKeyCode.IsMod2()) + mpAnnotationWindow->ToggleInsMode(); + } + else + { + long aOldHeight = mpAnnotationWindow->GetPostItTextHeight(); + bool bDone = false; + + /// HACK: need to switch off processing of Undo/Redo in Outliner + if ( !( (nKey == KEY_Z || nKey == KEY_Y) && rKeyCode.IsMod1()) ) + { + bool bIsProtected = mpAnnotationWindow->IsProtected(); + if (!bIsProtected || (bIsProtected && !mpAnnotationWindow->Engine()->GetEditEngine().DoesKeyChangeText(rKeyEvt)) ) + + bDone = mpOutlinerView->PostKeyEvent( rKeyEvt ); + } + if (bDone) + { + mpAnnotationWindow->ResizeIfNeccessary(aOldHeight,mpAnnotationWindow->GetPostItTextHeight()); + } + else + { + Control::KeyInput(rKeyEvt); + } + } +} + +void AnnotationTextWindow::MouseMove( const MouseEvent& rMEvt ) +{ + if ( mpOutlinerView ) + { + mpOutlinerView->MouseMove( rMEvt ); + SetPointer( mpOutlinerView->GetPointer( rMEvt.GetPosPixel() ) ); + } +} + +void AnnotationTextWindow::MouseButtonDown( const MouseEvent& rMEvt ) +{ + GrabFocus(); + if ( mpOutlinerView ) + mpOutlinerView->MouseButtonDown( rMEvt ); + // todo mpOutlinerView->DocView()->GetViewFrame()->GetBindings().InvalidateAll(FALSE); +} + +void AnnotationTextWindow::MouseButtonUp( const MouseEvent& rMEvt ) +{ + if ( mpOutlinerView ) + mpOutlinerView->MouseButtonUp( rMEvt ); +} + +void AnnotationTextWindow::Command( const CommandEvent& rCEvt ) +{ + if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) + { + mpAnnotationWindow->Command(rCEvt); + } + else + { + if ( mpOutlinerView ) + mpOutlinerView->Command( rCEvt ); + else + Window::Command(rCEvt); + } +} + +void AnnotationTextWindow::GetFocus() +{ + Window::GetFocus(); +} + +void AnnotationTextWindow::LoseFocus() +{ +// if ( mpAnnotationWindow ) +// mpAnnotationWindow->UpdateAnnotation(); + + Window::LoseFocus(); +} + +XubString AnnotationTextWindow::GetSurroundingText() const +{ + if( mpOutlinerView ) + { + EditEngine *aEditEngine = mpOutlinerView->GetEditView().GetEditEngine(); + if( mpOutlinerView->HasSelection() ) + return mpOutlinerView->GetSelected(); + else + { + ESelection aSelection = mpOutlinerView->GetEditView().GetSelection(); + XubString aStr = aEditEngine->GetText(aSelection.nStartPara); + return aStr; + } + } + else + return XubString::EmptyString(); +} + +Selection AnnotationTextWindow::GetSurroundingTextSelection() const +{ + if( mpOutlinerView ) + { + if( mpOutlinerView->HasSelection() ) + return Selection( 0, mpOutlinerView->GetSelected().Len() ); + else + { + ESelection aSelection = mpOutlinerView->GetEditView().GetSelection(); + return Selection( aSelection.nStartPos, aSelection.nEndPos ); + } + } + else + return Selection( 0, 0 ); +} + +/************** AnnotationWindow***********************************++*/ + +AnnotationWindow::AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, Window* pParent ) +: FloatingWindow(pParent, WB_SYSTEMWINDOW|WB_BORDER|WB_NEEDSFOCUS) +, mrManager( rManager ) +, mpDocShell( pDocShell ) +, mpView( pDocShell->GetViewShell()->GetView() ) +, mpDoc( pDocShell->GetDoc() ) +, mpOutlinerView(0) +, mpOutliner(0) +, mpVScrollbar(0) +, mbReadonly(pDocShell->IsReadOnly()) +, mbProtected(false) +, mbMouseOverButton(false) +, mpTextWindow(0) +, mpMeta(0) +{ +} + +AnnotationWindow::~AnnotationWindow() +{ + delete mpMeta; + delete mpOutlinerView; + delete mpOutliner; + delete mpVScrollbar; + delete mpTextWindow; +} + +void AnnotationWindow::InitControls() +{ + // actual window which holds the user text + mpTextWindow = new AnnotationTextWindow(this, WB_NODIALOGCONTROL); + mpTextWindow->SetPointer(Pointer(POINTER_TEXT)); + + // window control for author and date + mpMeta = new MultiLineEdit(this,0); + mpMeta->SetReadOnly(); + mpMeta->SetRightToLeft(Application::GetSettings().GetLayoutRTL()); + mpMeta->AlwaysDisableInput(true); + mpMeta->SetCallHandlersOnInputDisabled(true); + +// mpMeta->AddEventListener( LINK( mpPostItTxt, PostItTxt, WindowEventListener ) ); +// AddEventListener( LINK( mpTextWindow, PostItTxt, WindowEventListener ) ); + + // we should leave this setting alone, but for this we need a better layout algo + // with variable meta size height + AllSettings aSettings = mpMeta->GetSettings(); + StyleSettings aStyleSettings = aSettings.GetStyleSettings(); + Font aFont = aStyleSettings.GetFieldFont(); + aFont.SetHeight(8); + aStyleSettings.SetFieldFont(aFont); + aSettings.SetStyleSettings(aStyleSettings); + mpMeta->SetSettings(aSettings); + + mpOutliner = new ::Outliner(GetAnnotationPool(),OUTLINERMODE_TEXTOBJECT); + Doc()->SetCalcFieldValueHdl( mpOutliner ); + mpOutliner->SetUpdateMode( TRUE ); + Rescale(); + + OutputDevice* pDev = Doc()->GetRefDevice(); + if( pDev ) + { + mpOutliner->SetRefDevice( pDev ); + } + + mpOutlinerView = new OutlinerView ( mpOutliner, mpTextWindow ); + mpOutliner->InsertView(mpOutlinerView ); + mpTextWindow->SetOutlinerView(mpOutlinerView); + mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,1,1) ) ); + +// SfxItemSet item(DocShell()->GetPool()); +// item.Put(SvxFontHeightItem(352,100,EE_CHAR_FONTHEIGHT)); +// mpOutlinerView->SetAttribs(item); + + // TODO: ?? + EEHorizontalTextDirection aDefHoriTextDir = Application::GetSettings().GetLayoutRTL() ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R; + mpOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir ); + + //create Scrollbars + mpVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG); + mpVScrollbar->EnableNativeWidget(false); + mpVScrollbar->EnableRTL( false ); + mpVScrollbar->SetScrollHdl(LINK(this, AnnotationWindow, ScrollHdl)); + mpVScrollbar->EnableDrag(); +// mpVScrollbar->AddEventListener( LINK( this, AnnotationWindow, WindowEventListener ) ); + + ULONG nCntrl = mpOutliner->GetControlWord(); + nCntrl |= EE_CNTRL_PASTESPECIAL | EE_CNTRL_AUTOCORRECT | EV_CNTRL_AUTOSCROLL | EE_CNTRL_NOCOLORS; +/* + if (pVOpt->IsFieldShadings()) + nCntrl |= EE_CNTRL_MARKFIELDS; + else + nCntrl &= ~EE_CNTRL_MARKFIELDS; + if (pVOpt->IsOnlineSpell()) + nCntrl |= EE_CNTRL_ONLINESPELLING; + else + nCntrl &= ~EE_CNTRL_ONLINESPELLING; +*/ + mpOutliner->SetControlWord(nCntrl); +// mpOutliner->SetFlatMode( TRUE ); + + Engine()->SetModifyHdl( Link() ); + Engine()->EnableUndo( FALSE ); + + Engine()->ClearModifyFlag(); + Engine()->GetUndoManager().Clear(); + Engine()->EnableUndo( TRUE ); + Engine()->SetModifyHdl( LINK( this, AnnotationWindow, ModifyHdl ) ); + + Invalidate(); + + SetLanguage(GetLanguage()); + + mpMeta->Show(); + mpVScrollbar->Show(); + mpTextWindow->Show(); +} + +void AnnotationWindow::StartEdit() +{ + getView()->SetSelection(ESelection(0xFFFF,0xFFFF,0xFFFF,0xFFFF)); + getView()->ShowCursor(); +} + +void AnnotationWindow::Rescale() +{ + MapMode aMode(MAP_100TH_MM); + aMode.SetOrigin( Point() ); + //aMode.SetScaleX( aMode.GetScaleX() * Fraction( 8, 10 ) ); + //aMode.SetScaleY( aMode.GetScaleY() * Fraction( 8, 10 ) ); + mpOutliner->SetRefMapMode( aMode ); + SetMapMode( aMode ); + mpTextWindow->SetMapMode( aMode ); + if ( mpMeta ) + { + Font aFont( mpMeta->GetSettings().GetStyleSettings().GetFieldFont() ); + sal_Int32 nHeight = aFont.GetHeight(); + nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator(); + aFont.SetHeight( nHeight ); + mpMeta->SetControlFont( aFont ); + } +} + +void AnnotationWindow::DoResize() +{ + unsigned long aWidth = GetSizePixel().Width(); + long aHeight = GetSizePixel().Height() - POSTIT_META_HEIGHT; + + mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ; + long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height(); + + if( aTextHeight > aHeight ) + { // we need vertical scrollbars and have to reduce the width + aWidth -= GetScrollbarWidth(); + mpVScrollbar->Show(); + } + else + { + mpVScrollbar->Hide(); + } + + mpTextWindow->SetPosSizePixel(0,0,aWidth, aHeight); + + if( mbReadonly ) + mpMeta->SetPosSizePixel(0,aHeight,GetSizePixel().Width(),POSTIT_META_HEIGHT); + else + mpMeta->SetPosSizePixel(0,aHeight,GetSizePixel().Width()-METABUTTON_AREA_WIDTH,POSTIT_META_HEIGHT); + + mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ; + mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) ); + if (!mpVScrollbar->IsVisible()) + { // if we do not have a scrollbar anymore, we want to see the complete text + mpOutlinerView->SetVisArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) ); + } + mpVScrollbar->SetPosSizePixel( 0 + aWidth, 0, GetScrollbarWidth(), aHeight ); + mpVScrollbar->SetVisibleSize( PixelToLogic(Size(0,aHeight)).Height() ); + mpVScrollbar->SetPageSize( PixelToLogic(Size(0,aHeight)).Height() * 8 / 10 ); + mpVScrollbar->SetLineSize( mpOutliner->GetTextHeight() / 10 ); + SetScrollbar(); + mpVScrollbar->SetRange( Range(0, mpOutliner->GetTextHeight())); + + Point aPos( mpMeta->GetPosPixel()); + Point aBase( aPos.X() + aPos.X() + GetSizePixel().Width(), aPos.Y() ); + Point aLeft = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH+5), aBase.Y()+17 ) ); + Point aRight = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH-1), aBase.Y()+17 ) ); + Point aBottom = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH+2), aBase.Y()+20 ) ); + + maPopupTriangle.clear(); + maPopupTriangle.append(basegfx::B2DPoint(aLeft.X(),aLeft.Y())); + maPopupTriangle.append(basegfx::B2DPoint(aRight.X(),aRight.Y())); + maPopupTriangle.append(basegfx::B2DPoint(aBottom.X(),aBottom.Y())); + maPopupTriangle.setClosed(true); + maRectMetaButton = PixelToLogic( Rectangle( Point( + aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10), + aPos.Y()+5 ), + Size( METABUTTON_WIDTH, METABUTTON_HEIGHT ) ) ); + +} + +void AnnotationWindow::SetSizePixel( const Size& rNewSize ) +{ + Window::SetSizePixel(rNewSize); +} + +void AnnotationWindow::SetScrollbar() +{ + mpVScrollbar->SetThumbPos( mpOutlinerView->GetVisArea().Top()+ mpOutlinerView->GetEditView().GetCursor()->GetOffsetY()); +} + +void AnnotationWindow::ResizeIfNeccessary(long aOldHeight, long aNewHeight) +{ + if (aOldHeight != aNewHeight) + { + DoResize(); + Invalidate(); + } + else + { + SetScrollbar(); + } +} + +void AnnotationWindow::SetReadonly(bool bSet) +{ + mbReadonly = bSet; + getView()->SetReadOnly(bSet); +} + +void AnnotationWindow::SetLanguage(const SvxLanguageItem aNewItem) +{ + Engine()->SetModifyHdl( Link() ); + ESelection aOld = getView()->GetSelection(); + + ESelection aNewSelection( 0, 0, (USHORT)Engine()->GetParagraphCount()-1, USHRT_MAX ); + getView()->SetSelection( aNewSelection ); + SfxItemSet aEditAttr(getView()->GetAttribs()); + aEditAttr.Put(aNewItem); + getView()->SetAttribs( aEditAttr ); + + getView()->SetSelection(aOld); + Engine()->SetModifyHdl( LINK( this, AnnotationWindow, ModifyHdl ) ); + + Invalidate(); +} + +void AnnotationWindow::ToggleInsMode() +{ + if( mpOutlinerView ) + { + SfxBindings &rBnd = mpDocShell->GetViewShell()->GetViewFrame()->GetBindings(); + rBnd.Invalidate(SID_ATTR_INSERT); + rBnd.Update(SID_ATTR_INSERT); + } +} + +long AnnotationWindow::GetPostItTextHeight() +{ + return mpOutliner ? LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0; +} + +IMPL_LINK(AnnotationWindow, ScrollHdl, ScrollBar*, pScroll) +{ + long nDiff = getView()->GetEditView().GetVisArea().Top() - pScroll->GetThumbPos(); + getView()->Scroll( 0, nDiff ); + return 0; +} + +IMPL_LINK(AnnotationWindow, ModifyHdl, void*, EMPTYARG) +{ + return 0; +} + +sal_Int32 AnnotationWindow::GetScrollbarWidth() +{ + return 16; +// return mpView->GetWrtShell().GetViewOptions()->GetZoom() / 10; +} + +SvxLanguageItem AnnotationWindow::GetLanguage(void) +{ + return SvxLanguageItem( Doc()->GetLanguage( EE_CHAR_LANGUAGE ), SID_ATTR_LANGUAGE ); +} + +// -------------------------------------------------------------------- + +TextApiObject* getTextApiObject( const Reference< XAnnotation >& xAnnotation ) +{ + if( xAnnotation.is() ) + { + Reference< XText > xText( xAnnotation->getTextRange() ); + return TextApiObject::getImplementation( xText ); + } + return 0; +} + +// -------------------------------------------------------------------- + +void AnnotationWindow::setAnnotation( const Reference< XAnnotation >& xAnnotation, bool bGrabFocus ) +{ + if( (xAnnotation != mxAnnotation) && xAnnotation.is() ) + { + mxAnnotation = xAnnotation; + + SetColor(); + + SvtUserOptions aUserOptions; + mbProtected = aUserOptions.GetFullName() != xAnnotation->getAuthor(); + + Engine()->Clear(); + TextApiObject* pTextApi = getTextApiObject( mxAnnotation ); + + if( pTextApi ) + { + std::auto_ptr< OutlinerParaObject > pOPO( pTextApi->CreateText() ); + Engine()->SetText( *pOPO.get() ); + } + + Engine()->SetModifyHdl( LINK( this, AnnotationWindow, ModifyHdl ) ); + Engine()->ClearModifyFlag(); + Engine()->GetUndoManager().Clear(); + + Invalidate(); + + OUString sMeta( xAnnotation->getAuthor() ); + OUString sDateTime( getAnnotationDateTimeString(xAnnotation) ); + + if( sDateTime.getLength() != 0 ) + { + if( sMeta.getLength() != 0 ) + sMeta += OUString( RTL_CONSTASCII_USTRINGPARAM( "\n" ) ); + + sMeta += sDateTime; + } + mpMeta->SetText(sMeta); + + if( bGrabFocus ) + GrabFocus(); + } +} + +void AnnotationWindow::SetColor() +{ + sal_uInt16 nAuthorIdx = mpDoc->GetAnnotationAuthorIndex( mxAnnotation->getAuthor() ); + + maColor = mrManager.GetColor( nAuthorIdx ); + maColorDark = mrManager.GetColorDark( nAuthorIdx ); + maColorLight = mrManager.GetColorLight( nAuthorIdx ); + + mpOutlinerView->SetBackgroundColor(maColor); + + mpMeta->SetControlBackground(maColor); + AllSettings aSettings = mpMeta->GetSettings(); + StyleSettings aStyleSettings = aSettings.GetStyleSettings(); + aStyleSettings.SetFieldTextColor(maColorDark); + aSettings.SetStyleSettings(aStyleSettings); + mpMeta->SetSettings(aSettings); + + AllSettings aSettings2 = mpVScrollbar->GetSettings(); + StyleSettings aStyleSettings2 = aSettings2.GetStyleSettings(); + aStyleSettings2.SetButtonTextColor(Color(0,0,0)); + aStyleSettings2.SetCheckedColor(maColorLight); //hintergund + aStyleSettings2.SetShadowColor(maColorDark); + aStyleSettings2.SetFaceColor(maColor); + aSettings2.SetStyleSettings(aStyleSettings2); + mpVScrollbar->SetSettings(aSettings2); +} + +void AnnotationWindow::Deactivate() +{ + Reference< XAnnotation > xAnnotation( mxAnnotation ); +/* + // check if text is empty + Paragraph* p1stPara=Engine()->GetParagraph( 0 ); + ULONG nParaAnz=Engine()->GetParagraphCount(); + if(p1stPara==NULL) + nParaAnz=0; + + if(nParaAnz==1) + { + // if it is only one paragraph, check if that paragraph is empty + XubString aStr(Engine()->GetText(p1stPara)); + + if(!aStr.Len()) + nParaAnz = 0; + } + + if( nParaAnz == 0 ) + { + // text is empty, delete postit + DeleteAnnotation( xAnnotation ); + } + else +*/ + { + // write changed text back to annotation + if ( Engine()->IsModified() ) + { + TextApiObject* pTextApi = getTextApiObject( xAnnotation ); + + if( pTextApi ) + { + OutlinerParaObject* pOPO = Engine()->CreateParaObject(); + if( pOPO ) + { + if( mpDoc->IsUndoEnabled() ) + mpDoc->BegUndo( String( SdResId( STR_ANNOTATION_UNDO_EDIT ) ) ); + + pTextApi->SetText( *pOPO ); + delete pOPO; + + // set current time to changed annotation + xAnnotation->setDateTime( getCurrentDateTime() ); + + if( mpDoc->IsUndoEnabled() ) + mpDoc->EndUndo(); + + DocView()->GetDocSh()->SetModified(sal_True); + } + + } + } + Engine()->ClearModifyFlag(); + } + + Engine()->GetUndoManager().Clear(); +} + +void AnnotationWindow::Paint( const Rectangle& rRect) +{ + FloatingWindow::Paint( rRect ); + + if(mpMeta->IsVisible() && !mbReadonly) + { + //draw left over space + if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) + SetFillColor(COL_BLACK); + else + SetFillColor(maColor); + SetLineColor(); + DrawRect(PixelToLogic(Rectangle(Point(mpMeta->GetPosPixel().X()+mpMeta->GetSizePixel().Width(),mpMeta->GetPosPixel().Y()),Size(METABUTTON_AREA_WIDTH,mpMeta->GetSizePixel().Height())))); + + if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode()) + { + //draw rect around button + SetFillColor(COL_BLACK); + SetLineColor(COL_WHITE); + } + else + { + //draw button + Gradient aGradient; + if (mbMouseOverButton) + aGradient = Gradient(GRADIENT_LINEAR,ColorFromAlphaColor(80,maColorDark,maColor),ColorFromAlphaColor(15,maColorDark,maColor)); + else + aGradient = Gradient(GRADIENT_LINEAR,ColorFromAlphaColor(15,maColorDark,maColor),ColorFromAlphaColor(80,maColorDark,maColor)); + DrawGradient(maRectMetaButton,aGradient); + //draw rect around button + SetFillColor(); + SetLineColor(ColorFromAlphaColor(90,maColorDark,maColor)); + } + DrawRect(maRectMetaButton); + + //draw arrow + if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) + SetFillColor(COL_WHITE); + else + SetFillColor(COL_BLACK); + SetLineColor(); + DrawPolygon(Polygon(maPopupTriangle)); + } +} + +void AnnotationWindow::MouseMove( const MouseEvent& rMEvt ) +{ + if( !mbReadonly ) + { + if (maRectMetaButton.IsInside(PixelToLogic(rMEvt.GetPosPixel()))) + { + if (!mbMouseOverButton) + { + Invalidate(maRectMetaButton); + mbMouseOverButton = true; + } + } + else + { + if (mbMouseOverButton) + { + Invalidate(maRectMetaButton); + mbMouseOverButton = false; + } + } + } +} + +void AnnotationWindow::MouseButtonDown( const MouseEvent& rMEvt ) +{ + if (!mbReadonly && maRectMetaButton.IsInside(PixelToLogic(rMEvt.GetPosPixel())) && rMEvt.IsLeft()) + { + // context menu + Rectangle aRect(LogicToPixel(maRectMetaButton.BottomLeft()),LogicToPixel(maRectMetaButton.BottomLeft())); + mrManager.ExecuteAnnotationContextMenu( mxAnnotation, (::Window*)this, aRect, true ); + } +} + +void AnnotationWindow::Command( const CommandEvent& rCEvt ) +{ + if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) + { + mrManager.ExecuteAnnotationContextMenu( mxAnnotation, this, Rectangle(rCEvt.GetMousePosPixel(),Size(1,1)) ); + } + else + { + FloatingWindow::Command(rCEvt); + } +} + +void AnnotationWindow::GetFocus() +{ + if( mpTextWindow ) + mpTextWindow->GrabFocus(); + else + FloatingWindow::GetFocus(); +} + +void AnnotationWindow::ExecuteSlot( USHORT nSID ) +{ + if( nSID == SID_COPY ) + { + getView()->Copy(); + } + else if( nSID == SID_PASTE ) + { + getView()->PasteSpecial(); + DoResize(); + } + else + { + SfxItemSet aEditAttr(getView()->GetAttribs()); + SfxItemSet aNewAttr(mpOutliner->GetEmptyItemSet()); + + switch( nSID ) + { + case SID_ATTR_CHAR_WEIGHT: + { + FontWeight eFW = ( (const SvxWeightItem&) aEditAttr.Get( EE_CHAR_WEIGHT ) ).GetWeight(); + aNewAttr.Put( SvxWeightItem( eFW == WEIGHT_NORMAL ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) ); + } + break; + case SID_ATTR_CHAR_POSTURE: + { + FontItalic eFI = ( (const SvxPostureItem&) aEditAttr.Get( EE_CHAR_ITALIC ) ).GetPosture(); + aNewAttr.Put( SvxPostureItem( eFI == ITALIC_NORMAL ? ITALIC_NONE : ITALIC_NORMAL, EE_CHAR_ITALIC ) ); + } + break; + case SID_ATTR_CHAR_UNDERLINE: + { + FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr. Get( EE_CHAR_UNDERLINE ) ).GetLineStyle(); + aNewAttr.Put( SvxUnderlineItem( eFU == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE ) ); + } + break; + case SID_ATTR_CHAR_STRIKEOUT: + { + FontStrikeout eFSO = ( ( (const SvxCrossedOutItem&) aEditAttr.Get( EE_CHAR_STRIKEOUT ) ).GetStrikeout() ); + aNewAttr.Put( SvxCrossedOutItem( eFSO == STRIKEOUT_SINGLE ? STRIKEOUT_NONE : STRIKEOUT_SINGLE, EE_CHAR_STRIKEOUT ) ); + } + break; + } + getView()->SetAttribs( aNewAttr ); + } +} + +} diff --git a/sd/source/ui/annotations/annotationwindow.hxx b/sd/source/ui/annotations/annotationwindow.hxx new file mode 100644 index 000000000000..bdfe36c4ebf2 --- /dev/null +++ b/sd/source/ui/annotations/annotationwindow.hxx @@ -0,0 +1,180 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: postit.hxx,v $ + * + * $Revision: 1.8.84.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _ANNOTATIONWINDOW_HXX +#define _ANNOTATIONWINDOW_HXX + +#include + +#include +#include + +#include +#include +#include + +#include + +#include +#include + +class OutlinerView; +class Outliner; +class ScrollBar; +class Edit; +class MultiLineEdit; +class PopupMenu; +class SvxLanguageItem; +class OutlinerParaObject; +class SdDrawDocument; + +namespace sd { + +class AnnotationManagerImpl; +class AnnotationWindow; +class DrawDocShell; +class View; + +class AnnotationTextWindow : public Control +{ +private: + OutlinerView* mpOutlinerView; + AnnotationWindow* mpAnnotationWindow; + +protected: + virtual void Paint( const Rectangle& rRect); + virtual void KeyInput( const KeyEvent& rKeyEvt ); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + virtual void Command( const CommandEvent& rCEvt ); + virtual void LoseFocus(); + +public: + AnnotationTextWindow( AnnotationWindow* pParent, WinBits nBits ); + ~AnnotationTextWindow(); + + void SetOutlinerView( OutlinerView* pOutlinerView ) { mpOutlinerView = pOutlinerView; } + + virtual XubString GetSurroundingText() const; + virtual Selection GetSurroundingTextSelection() const; + + virtual void GetFocus(); +}; + + +class AnnotationWindow : public FloatingWindow +{ + private: + AnnotationManagerImpl& mrManager; + DrawDocShell* mpDocShell; + View* mpView; + SdDrawDocument* mpDoc; + + OutlinerView* mpOutlinerView; + Outliner* mpOutliner; + ScrollBar* mpVScrollbar; + ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxAnnotation; + bool mbReadonly; + bool mbProtected; + bool mbMouseOverButton; + AnnotationTextWindow* mpTextWindow; + MultiLineEdit* mpMeta; + Rectangle maRectMetaButton; + basegfx::B2DPolygon maPopupTriangle; + + protected: + void SetSizePixel( const Size& rNewSize ); + + DECL_LINK(ModifyHdl, void*); + DECL_LINK(ScrollHdl, ScrollBar*); + + public: + AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, ::Window* pParent ); + virtual ~AnnotationWindow(); + + void StartEdit(); + + virtual SvxLanguageItem GetLanguage(void); + + void setAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, bool bGrabFocus = false ); + const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& getAnnotation() const { return mxAnnotation; } + + void ExecuteSlot( USHORT nSID ); + + ScrollBar* Scrollbar() { return mpVScrollbar;} + + DrawDocShell* DocShell() { return mpDocShell; } + OutlinerView* getView() { return mpOutlinerView; } + sd::View* DocView() { return mpView; } + Outliner* Engine() { return mpOutliner; } + SdDrawDocument* Doc() { return mpDoc; } + + long GetPostItTextHeight(); + + void InitControls(); + void HidePostIt(); + void DoResize(); + void ResizeIfNeccessary(long aOldHeight, long aNewHeight); + void SetScrollbar(); + + void Rescale(); + + void SetReadonly(bool bSet); + bool IsReadOnly() { return mbReadonly;} + + bool IsProtected() { return mbProtected; } + + void SetLanguage(const SvxLanguageItem aNewItem); + + sal_Int32 GetScrollbarWidth(); + + void ToggleInsMode(); + + DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*); + + virtual void Deactivate(); + virtual void Paint( const Rectangle& rRect); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void Command( const CommandEvent& rCEvt ); + virtual void GetFocus(); + + void SetColor(); + + Color maColor; + Color maColorDark; + Color maColorLight; +}; + +} // namespace sd + +#endif diff --git a/sd/source/ui/annotations/makefile.mk b/sd/source/ui/annotations/makefile.mk new file mode 100644 index 000000000000..f457474c6990 --- /dev/null +++ b/sd/source/ui/annotations/makefile.mk @@ -0,0 +1,60 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PROJECTPCH=sd +PROJECTPCHSOURCE=$(PRJ)$/util$/sd +PRJNAME=sd +TARGET=uiannotations +ENABLE_EXCEPTIONS=TRUE +AUTOSEG=true + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SRS1NAME=$(TARGET) +SRC1FILES =\ + annotations.src + +SLOFILES = \ + $(SLO)$/annotationwindow.obj \ + $(SLO)$/annotationtag.obj \ + $(SLO)$/annotationmanager.obj + + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx index 122d0263164f..673e00477d46 100644 --- a/sd/source/ui/app/optsitem.cxx +++ b/sd/source/ui/app/optsitem.cxx @@ -527,6 +527,7 @@ SdOptionsMisc::SdOptionsMisc( USHORT nConfigId, BOOL bUseConfig ) : // #90356# bShowUndoDeleteWarning( TRUE ), bSlideshowRespectZOrder( TRUE ), + bShowComments( TRUE ), bPreviewNewEffects( TRUE ), bPreviewChangedEffects( FALSE ), bPreviewTransitions( TRUE ), @@ -569,6 +570,7 @@ void SdOptionsMisc::SetDefaults() SetPreviewChangedEffects(false); SetPreviewTransitions(true); SetDisplay(0); + SetShowComments(true); } // ----------------------------------------------------------------------------- @@ -601,8 +603,8 @@ BOOL SdOptionsMisc::operator==( const SdOptionsMisc& rOpt ) const IsPreviewNewEffects() == rOpt.IsPreviewNewEffects() && IsPreviewChangedEffects() == rOpt.IsPreviewChangedEffects() && IsPreviewTransitions() == rOpt.IsPreviewTransitions() && - GetDisplay() == rOpt.GetDisplay() - + GetDisplay() == rOpt.GetDisplay() && + IsShowComments() == rOpt.IsShowComments() ); } @@ -630,6 +632,8 @@ void SdOptionsMisc::GetPropNameArray( const char**& ppNames, ULONG& rCount ) con "Compatibility/PrinterIndependentLayout", + "ShowComments", + // just for impress "NewDoc/AutoPilot", "Start/CurrentPage", @@ -645,9 +649,7 @@ void SdOptionsMisc::GetPropNameArray( const char**& ppNames, ULONG& rCount ) con "Display" }; - // #90356# rCount = ( ( GetConfigId() == SDCFG_IMPRESS ) ? 15 : 12 ); - // #97016# rCount = ( ( GetConfigId() == SDCFG_IMPRESS ) ? 16 : 12 ); - rCount = ( ( GetConfigId() == SDCFG_IMPRESS ) ? 24 : 15 ); + rCount = ( ( GetConfigId() == SDCFG_IMPRESS ) ? 25 : 16 ); ppNames = aPropNames; } @@ -672,33 +674,35 @@ BOOL SdOptionsMisc::ReadData( const Any* pValues ) if( pValues[13].hasValue() ) SetDefaultObjectSizeHeight( *(sal_uInt32*) pValues[ 13 ].getValue() ); if( pValues[14].hasValue() ) SetPrinterIndependentLayout( *(sal_uInt16*) pValues[ 14 ].getValue() ); + if( pValues[15].hasValue() ) SetShowComments( *(sal_Bool*) pValues[ 11 ].getValue() ); + // just for Impress if( GetConfigId() == SDCFG_IMPRESS ) { - if( pValues[15].hasValue() ) - SetStartWithTemplate( *(sal_Bool*) pValues[ 15 ].getValue() ); if( pValues[16].hasValue() ) - SetStartWithActualPage( *(sal_Bool*) pValues[ 16 ].getValue() ); + SetStartWithTemplate( *(sal_Bool*) pValues[ 16 ].getValue() ); if( pValues[17].hasValue() ) - SetSummationOfParagraphs( *(sal_Bool*) pValues[ 17 ].getValue() ); - // #90356# + SetStartWithActualPage( *(sal_Bool*) pValues[ 17 ].getValue() ); if( pValues[18].hasValue() ) - SetShowUndoDeleteWarning( *(sal_Bool*) pValues[ 18 ].getValue() ); - + SetSummationOfParagraphs( *(sal_Bool*) pValues[ 18 ].getValue() ); + // #90356# if( pValues[19].hasValue() ) - SetSlideshowRespectZOrder(*(sal_Bool*) pValues[ 19 ].getValue()); + SetShowUndoDeleteWarning( *(sal_Bool*) pValues[ 19 ].getValue() ); if( pValues[20].hasValue() ) - SetPreviewNewEffects(*(sal_Bool*) pValues[ 20 ].getValue()); + SetSlideshowRespectZOrder(*(sal_Bool*) pValues[ 20 ].getValue()); if( pValues[21].hasValue() ) - SetPreviewChangedEffects(*(sal_Bool*) pValues[ 21 ].getValue()); + SetPreviewNewEffects(*(sal_Bool*) pValues[ 21 ].getValue()); if( pValues[22].hasValue() ) - SetPreviewTransitions(*(sal_Bool*) pValues[ 22 ].getValue()); + SetPreviewChangedEffects(*(sal_Bool*) pValues[ 22 ].getValue()); if( pValues[23].hasValue() ) - SetDisplay(*(sal_Int32*) pValues[ 23 ].getValue()); + SetPreviewTransitions(*(sal_Bool*) pValues[ 23 ].getValue()); + + if( pValues[24].hasValue() ) + SetDisplay(*(sal_Int32*) pValues[ 24 ].getValue()); } return TRUE; @@ -725,22 +729,23 @@ BOOL SdOptionsMisc::WriteData( Any* pValues ) const pValues[ 12 ] <<= GetDefaultObjectSizeWidth(); pValues[ 13 ] <<= GetDefaultObjectSizeHeight(); pValues[ 14 ] <<= GetPrinterIndependentLayout(); + pValues[ 15 ] <<= (sal_Bool)IsShowComments(); // just for Impress if( GetConfigId() == SDCFG_IMPRESS ) { - pValues[ 15 ] <<= IsStartWithTemplate(); - pValues[ 16 ] <<= IsStartWithActualPage(); - pValues[ 17 ] <<= IsSummationOfParagraphs(); + pValues[ 16 ] <<= IsStartWithTemplate(); + pValues[ 17 ] <<= IsStartWithActualPage(); + pValues[ 18 ] <<= IsSummationOfParagraphs(); // #90356# - pValues[ 18 ] <<= IsShowUndoDeleteWarning(); - pValues[ 19 ] <<= IsSlideshowRespectZOrder(); + pValues[ 19 ] <<= IsShowUndoDeleteWarning(); + pValues[ 20 ] <<= IsSlideshowRespectZOrder(); - pValues[ 20 ] <<= IsPreviewNewEffects(); - pValues[ 21 ] <<= IsPreviewChangedEffects(); - pValues[ 22 ] <<= IsPreviewTransitions(); + pValues[ 21 ] <<= IsPreviewNewEffects(); + pValues[ 22 ] <<= IsPreviewChangedEffects(); + pValues[ 23 ] <<= IsPreviewTransitions(); - pValues[ 23 ] <<= GetDisplay(); + pValues[ 24 ] <<= GetDisplay(); } return TRUE; diff --git a/sd/source/ui/app/res_bmp.src b/sd/source/ui/app/res_bmp.src index 11c711376f2a..4796be585d1e 100644 --- a/sd/source/ui/app/res_bmp.src +++ b/sd/source/ui/app/res_bmp.src @@ -554,3 +554,11 @@ Bitmap BMP_FADE_EFFECT_INDICATOR_H { File = "fade_effect_indicator_hc.bmp"; }; +Bitmap BMP_COMMENTS_INDICATOR +{ + File = "comments_indicator.bmp"; +}; +Bitmap BMP_COMMENTS_INDICATOR_H +{ + File = "comments_indicator_hc.bmp"; +}; \ No newline at end of file diff --git a/sd/source/ui/app/strings.src b/sd/source/ui/app/strings.src index 364fe567f990..696e92940b9f 100644 --- a/sd/source/ui/app/strings.src +++ b/sd/source/ui/app/strings.src @@ -1269,5 +1269,7 @@ String STR_SET_BACKGROUND_PICTURE { Text [ en-US ] = "Set Background Picture for Slide ..." ; }; - - +String RID_ANNOTATIONS_START +{ + Text [ en-US ] = "Comments"; +}; diff --git a/sd/source/ui/framework/configuration/ConfigurationController.cxx b/sd/source/ui/framework/configuration/ConfigurationController.cxx index 731b9d6963c0..ef7fd4cdbf00 100644 --- a/sd/source/ui/framework/configuration/ConfigurationController.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationController.cxx @@ -59,7 +59,7 @@ using rtl::OUString; using ::sd::framework::FrameworkHelper; #undef VERBOSE -//#define VERBOSE 3 +#define VERBOSE 3 namespace sd { namespace framework { diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx index 5721f483595f..e2aab7316937 100644 --- a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx @@ -49,7 +49,7 @@ using ::rtl::OUString; using ::std::vector; #undef VERBOSE -//#define VERBOSE 2 +#define VERBOSE 2 namespace { static const sal_Int32 snShortTimeout (100); diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx index 3a9cb6c0714e..c6b8f9feaab2 100644 --- a/sd/source/ui/func/fupoor.cxx +++ b/sd/source/ui/func/fupoor.cxx @@ -506,6 +506,9 @@ BOOL FuPoor::KeyInput(const KeyEvent& rKEvt) case KEY_PAGEUP: { + if( rKEvt.GetKeyCode().IsMod1() && rKEvt.GetKeyCode().IsMod2() ) + break; + if(mpViewShell->ISA(DrawViewShell) && !bSlideShow) { // The page-up key switches layers or pages depending on the @@ -551,6 +554,8 @@ BOOL FuPoor::KeyInput(const KeyEvent& rKEvt) case KEY_PAGEDOWN: { + if( rKEvt.GetKeyCode().IsMod1() && rKEvt.GetKeyCode().IsMod2() ) + break; if(mpViewShell->ISA(DrawViewShell) && !bSlideShow) { // The page-down key switches layers or pages depending on the diff --git a/sd/source/ui/func/smarttag.cxx b/sd/source/ui/func/smarttag.cxx index c958a398bcf9..ecd2c7a685f6 100644 --- a/sd/source/ui/func/smarttag.cxx +++ b/sd/source/ui/func/smarttag.cxx @@ -68,6 +68,18 @@ bool SmartTag::KeyInput( const KeyEvent& /*rKEvt*/ ) return false; } +/** returns true if the SmartTag consumes this event. */ +bool SmartTag::RequestHelp( const HelpEvent& /*rHEvt*/ ) +{ + return false; +} + +/** returns true if the SmartTag consumes this event. */ +bool SmartTag::Command( const CommandEvent& /*rCEvt*/ ) +{ + return false; +} + // -------------------------------------------------------------------- void SmartTag::addCustomHandles( SdrHdlList& /*rHandlerList*/ ) @@ -162,6 +174,7 @@ SmartTagSet::~SmartTagSet() void SmartTagSet::add( const SmartTagReference& xTag ) { maSet.insert( xTag ); + mrView.InvalidateAllWin(); } // -------------------------------------------------------------------- @@ -171,6 +184,7 @@ void SmartTagSet::remove( const SmartTagReference& xTag ) std::set< SmartTagReference >::iterator aIter( maSet.find( xTag ) ); if( aIter != maSet.end() ) maSet.erase( aIter ); + mrView.InvalidateAllWin(); } // -------------------------------------------------------------------- @@ -181,6 +195,7 @@ void SmartTagSet::Dispose() aSet.swap( maSet ); for( std::set< SmartTagReference >::iterator aIter( aSet.begin() ); aIter != aSet.end(); ) (*aIter++)->Dispose(); + mrView.InvalidateAllWin(); } // -------------------------------------------------------------------- @@ -247,8 +262,72 @@ bool SmartTagSet::KeyInput( const KeyEvent& rKEvt ) { if( mxSelectedTag.is() ) return mxSelectedTag->KeyInput( rKEvt ); + else if( rKEvt.GetKeyCode().GetCode() == KEY_SPACE ) + { + SmartHdl* pSmartHdl = dynamic_cast< SmartHdl* >( mrView.GetHdlList().GetFocusHdl() ); + if( pSmartHdl ) + { + const_cast< SdrHdlList& >( mrView.GetHdlList() ).ResetFocusHdl(); + SmartTagReference xTag( pSmartHdl->getTag() ); + select( xTag ); + return true; + } + } + + + return false; +} + +// -------------------------------------------------------------------- + +bool SmartTagSet::RequestHelp( const HelpEvent& rHEvt ) +{ + Point aMDPos( mrView.GetViewShell()->GetActiveWindow()->PixelToLogic( rHEvt.GetMousePosPixel() ) ); + SdrHdl* pHdl = mrView.PickHandle(aMDPos); + + if( pHdl ) + { + // if a smart tag handle is hit, foreward event to its smart tag + SmartHdl* pSmartHdl = dynamic_cast< SmartHdl* >( pHdl ); + if(pSmartHdl && pSmartHdl->getTag().is() ) + { + SmartTagReference xTag( pSmartHdl->getTag() ); + return xTag->RequestHelp( rHEvt ); + } + } + + return false; +} + +// -------------------------------------------------------------------- + +/** returns true if the SmartTag consumes this event. */ +bool SmartTagSet::Command( const CommandEvent& rCEvt ) +{ + if( rCEvt.IsMouseEvent() ) + { + Point aMDPos( mrView.GetViewShell()->GetActiveWindow()->PixelToLogic( rCEvt.GetMousePosPixel() ) ); + SdrHdl* pHdl = mrView.PickHandle(aMDPos); + + if( pHdl ) + { + // if a smart tag handle is hit, foreward event to its smart tag + SmartHdl* pSmartHdl = dynamic_cast< SmartHdl* >( pHdl ); + if(pSmartHdl && pSmartHdl->getTag().is() ) + { + SmartTagReference xTag( pSmartHdl->getTag() ); + return xTag->Command( rCEvt ); + } + } + } else - return false; + { + if( mxSelectedTag.is() ) + return mxSelectedTag->Command( rCEvt ); + + } + + return false; } // -------------------------------------------------------------------- diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index d85b09d6ab07..b9a3e062955b 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -59,6 +59,7 @@ class DrawView; class LayerTabBar; class Ruler; class SdUnoDrawView; +class AnnotationManager; #define CHECK_RANGE(nMin, nValue, nMax) ((nValue >= nMin) && (nValue <= nMax)) @@ -231,6 +232,9 @@ public: void AttrExec (SfxRequest& rReq); void AttrState (SfxItemSet& rSet); + void ExecuteAnnotation (SfxRequest& rRequest); + void GetAnnotationState (SfxItemSet& rItemSet); + void StartRulerDrag ( const Ruler& rRuler, const MouseEvent& rMEvt); @@ -391,7 +395,6 @@ protected: static BOOL mbPipette; - DECL_LINK( ClipboardChanged, TransferableDataHelper* ); DECL_LINK( CloseHdl, Timer* pTimer ); DECL_LINK( TabSplitHdl, TabBar * ); @@ -494,6 +497,8 @@ private: const Point& rMouseLocation); using ViewShell::Notify; + + ::std::auto_ptr< AnnotationManager > mpAnnotationManager; }; diff --git a/sd/source/ui/inc/annotationmanager.hxx b/sd/source/ui/inc/annotationmanager.hxx new file mode 100755 index 000000000000..4659b2add63f --- /dev/null +++ b/sd/source/ui/inc/annotationmanager.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AnnotationManager.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SD_ANNOTATIONMANAGER_HXX +#define _SD_ANNOTATIONMANAGER_HXX + +#include +#include + +#include + +namespace sd +{ + +class ViewShellBase; +class AnnotationManagerImpl; + +// -------------------------------------------------------------------- + +class AnnotationManager +{ +public: + AnnotationManager( ViewShellBase& rViewShellBase ); + ~AnnotationManager(); + + void ExecuteAnnotation (SfxRequest& rRequest); + void GetAnnotationState (SfxItemSet& rItemSet); + +private: + ::rtl::Reference< AnnotationManagerImpl > mxImpl; +}; + +} + +#endif // _SD_ANNOTATIONMANAGER_HXX diff --git a/sd/source/ui/inc/optsitem.hxx b/sd/source/ui/inc/optsitem.hxx index bd7ed5529a74..a67c91948617 100644 --- a/sd/source/ui/inc/optsitem.hxx +++ b/sd/source/ui/inc/optsitem.hxx @@ -276,6 +276,7 @@ private: BOOL bShowUndoDeleteWarning : 1; // Misc/ShowUndoDeleteWarning // #i75315# BOOL bSlideshowRespectZOrder : 1; // Misc/SlideshowRespectZOrder + BOOL bShowComments : 1; // Misc/ShowComments sal_Bool bPreviewNewEffects; sal_Bool bPreviewChangedEffects; @@ -320,6 +321,7 @@ public: BOOL IsSolidDragging() const { Init(); return (BOOL) bSolidDragging; } BOOL IsSolidMarkHdl() const { Init(); return (BOOL) bSolidMarkHdl; } BOOL IsSummationOfParagraphs() const { Init(); return bSummationOfParagraphs != 0; }; + /** Return the currently selected printer independent layout mode. @return Returns 1 for printer independent layout enabled and 0 when it @@ -372,6 +374,9 @@ public: void SetPreviewNewEffects( sal_Bool bOn ) { if( bPreviewNewEffects != bOn ) { OptionsChanged(); bPreviewNewEffects = bOn; } } void SetPreviewChangedEffects( sal_Bool bOn ) { if( bPreviewChangedEffects != bOn ) { OptionsChanged(); bPreviewChangedEffects = bOn; } } void SetPreviewTransitions( sal_Bool bOn ) { if( bPreviewTransitions != bOn ) { OptionsChanged(); bPreviewTransitions = bOn; } } + + BOOL IsShowComments() const { Init(); return bShowComments; } + void SetShowComments( BOOL bShow ) { if( bShowComments != bShow ) { OptionsChanged(); bShowComments = bShow; } } }; // ----------------------------------------------------------------------------- diff --git a/sd/source/ui/inc/res_bmp.hrc b/sd/source/ui/inc/res_bmp.hrc index 19834c60ace6..0dd5451c1f45 100644 --- a/sd/source/ui/inc/res_bmp.hrc +++ b/sd/source/ui/inc/res_bmp.hrc @@ -237,6 +237,9 @@ #define BMP_FOIL_27 RID_SD_START+336 #define BMP_FOIL_27_H RID_SD_START+337 +#define BMP_COMMENTS_INDICATOR RID_SD_START+338 +#define BMP_COMMENTS_INDICATOR_H RID_SD_START+339 + // ----------------------------------------------------------------------------- #define IMG_PIPETTE_H RID_APP_START+21 diff --git a/sd/source/ui/inc/smarttag.hxx b/sd/source/ui/inc/smarttag.hxx index a1d217d92a10..feaa0fa27fd8 100644 --- a/sd/source/ui/inc/smarttag.hxx +++ b/sd/source/ui/inc/smarttag.hxx @@ -67,6 +67,12 @@ public: /** returns true if the SmartTag consumes this event. */ virtual bool KeyInput( const KeyEvent& rKEvt ); + /** returns true if the SmartTag consumes this event. */ + virtual bool RequestHelp( const HelpEvent& rHEvt ); + + /** returns true if the SmartTag consumes this event. */ + virtual bool Command( const CommandEvent& rCEvt ); + /** returns true if this smart tag is currently selected */ bool isSelected() const; @@ -119,6 +125,12 @@ public: /** returns true if a SmartTag consumes this event. */ bool KeyInput( const KeyEvent& rKEvt ); + /** returns true if a SmartTag consumes this event. */ + bool RequestHelp( const HelpEvent& rHEvt ); + + /** returns true if a SmartTag consumes this event. */ + bool Command( const CommandEvent& rCEvt ); + /** disposes all smart tags and clears the set */ void Dispose(); diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx index ff3ddff0897f..3cd696e4bb26 100644 --- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx +++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx @@ -108,8 +108,6 @@ SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter) maModelBorder(), meOrientation(VERTICAL) { - maPageModel.GetItemPool().FreezeIdRanges(); - // Hide the page that contains the page objects. SetPageVisible (FALSE); diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx index 92a0abb72762..9b04cdaead79 100644 --- a/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx +++ b/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx @@ -596,12 +596,16 @@ private: /// Size of width and height of the fade effect indicator in pixels. static const sal_Int32 mnFadeEffectIndicatorOffset; + /// Size of width and height of the comments indicator in pixels. + static const sal_Int32 mnCommentsIndicatorOffset; + /// Gap between border of page object and number rectangle. static const sal_Int32 mnPageNumberOffset; - /// the FadeEffect bitmap. Static since it is usable outside this primitive + /// the indicator bitmaps. Static since it is usable outside this primitive /// for size comparisons static BitmapEx* mpFadeEffectIconBitmap; + static BitmapEx* mpCommentsIconBitmap; /// page name, number and needed infos String maPageName; @@ -611,10 +615,12 @@ private: // bitfield bool mbShowFadeEffectIcon : 1; + bool mbShowCommentsIcon : 1; bool mbExcluded : 1; // private helpers const BitmapEx& getFadeEffectIconBitmap() const; + const BitmapEx& getCommentsIconBitmap() const; protected: // method which is to be used to implement the local decomposition of a 2D primitive. @@ -629,6 +635,7 @@ public: const Font& rPageNameFont, const Size& rPageNumberAreaModelSize, bool bShowFadeEffectIcon, + bool bShowCommentsIcon, bool bExcluded); ~SdPageObjectFadeNameNumberPrimitive(); @@ -638,6 +645,7 @@ public: const Font& getPageNameFont() const { return maPageNameFont; } const Size& getPageNumberAreaModelSize() const { return maPageNumberAreaModelSize; } bool getShowFadeEffectIcon() const { return mbShowFadeEffectIcon; } + bool getShowCommentsIcon() const { return mbShowCommentsIcon; } bool getExcluded() const { return mbExcluded; } // compare operator @@ -666,6 +674,24 @@ const BitmapEx& SdPageObjectFadeNameNumberPrimitive::getFadeEffectIconBitmap() c return *mpFadeEffectIconBitmap; } +const sal_Int32 SdPageObjectFadeNameNumberPrimitive::mnCommentsIndicatorOffset(9); +BitmapEx* SdPageObjectFadeNameNumberPrimitive::mpCommentsIconBitmap = 0; + +const BitmapEx& SdPageObjectFadeNameNumberPrimitive::getCommentsIconBitmap() const +{ + if(mpCommentsIconBitmap == NULL) + { + // prepare CommentsIconBitmap on demand + const sal_uInt16 nIconId(Application::GetSettings().GetStyleSettings().GetHighContrastMode() + ? BMP_COMMENTS_INDICATOR_H + : BMP_COMMENTS_INDICATOR); + const BitmapEx aCommentsIconBitmap(IconCache::Instance().GetIcon(nIconId).GetBitmapEx()); + const_cast< SdPageObjectFadeNameNumberPrimitive* >(this)->mpCommentsIconBitmap = new BitmapEx(aCommentsIconBitmap); + } + + return *mpCommentsIconBitmap; +} + Primitive2DSequence SdPageObjectFadeNameNumberPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const { const xub_StrLen nTextLength(getPageName().Len()); @@ -851,6 +877,7 @@ SdPageObjectFadeNameNumberPrimitive::SdPageObjectFadeNameNumberPrimitive( const Font& rPageNameFont, const Size& rPageNumberAreaModelSize, bool bShowFadeEffectIcon, + bool bShowCommentsIcon, bool bExcluded) : SdPageObjectBasePrimitive(rRange), maPageName(rPageName), @@ -858,6 +885,7 @@ SdPageObjectFadeNameNumberPrimitive::SdPageObjectFadeNameNumberPrimitive( maPageNameFont(rPageNameFont), maPageNumberAreaModelSize(rPageNumberAreaModelSize), mbShowFadeEffectIcon(bShowFadeEffectIcon), + mbShowCommentsIcon(bShowCommentsIcon), mbExcluded(bExcluded) { } @@ -965,6 +993,7 @@ Primitive2DSequence PageObjectViewObjectContact::createPrimitive2DSequence(const sal_uInt32 nPageNumber(0); Size aPageNumberAreaModelSize; bool bShowFadeEffectIcon(false); + bool bShowCommentsIcon(false); bool bExcluded(false); if(GetPage()) @@ -977,6 +1006,8 @@ Primitive2DSequence PageObjectViewObjectContact::createPrimitive2DSequence(const bShowFadeEffectIcon = true; } + bShowCommentsIcon = !pPage->getAnnotations().empty(); + // prepare PageName, PageNumber, font and AreaModelSize aPageName = pPage->GetName(); aPageNameFont = *FontProvider::Instance().GetFont(*pDevice); @@ -1030,6 +1061,7 @@ Primitive2DSequence PageObjectViewObjectContact::createPrimitive2DSequence(const aPageNameFont, aPageNumberAreaModelSize, bShowFadeEffectIcon, + bShowCommentsIcon, bExcluded)); } diff --git a/sd/source/ui/toolpanel/TaskPaneShellManager.cxx b/sd/source/ui/toolpanel/TaskPaneShellManager.cxx index 53ca3cbe2d2e..6400a51bf44a 100644 --- a/sd/source/ui/toolpanel/TaskPaneShellManager.cxx +++ b/sd/source/ui/toolpanel/TaskPaneShellManager.cxx @@ -79,8 +79,18 @@ void TaskPaneShellManager::ReleaseShell (SfxShell* ) // Nothing to do. } +// hack for annotation panel, better fix? +void TaskPaneShellManager_AddSubShell ( TaskPaneShellManager* pManager, sal_Int32 nId, SfxShell* pShell, ::Window* pWindow ) +{ + if( pManager != NULL ) + pManager->AddSubShell( (ShellId)nId, pShell, pWindow ); +} - +void TaskPaneShellManager_RemoveSubShell ( TaskPaneShellManager* pManager, const SfxShell* pShell) +{ + if( pManager != NULL ) + pManager->RemoveSubShell( pShell ); +} void TaskPaneShellManager::AddSubShell ( ShellId nId, diff --git a/sd/source/ui/toolpanel/TaskPaneViewShell.cxx b/sd/source/ui/toolpanel/TaskPaneViewShell.cxx index 556fe2f1282f..2d1475ca980c 100644 --- a/sd/source/ui/toolpanel/TaskPaneViewShell.cxx +++ b/sd/source/ui/toolpanel/TaskPaneViewShell.cxx @@ -107,7 +107,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using ::sd::framework::FrameworkHelper; - namespace sd { namespace toolpanel { SFX_IMPL_INTERFACE(TaskPaneViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL)) diff --git a/sd/source/ui/toolpanel/controls/makefile.mk b/sd/source/ui/toolpanel/controls/makefile.mk index 4741144ca6ff..3664e852f0c5 100644 --- a/sd/source/ui/toolpanel/controls/makefile.mk +++ b/sd/source/ui/toolpanel/controls/makefile.mk @@ -66,7 +66,6 @@ SLOFILES = \ $(SLO)$/TableDesignPanel.obj \ $(SLO)$/AnimationSchemesPanel.obj - # --- Tagets ------------------------------------------------------- .INCLUDE : target.mk diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 2178f1ae0006..8906059e57cf 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -3030,3 +3030,14 @@ void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEvent xModel->notifyEvent(aEvent ); } } + +void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName, const uno::Reference< uno::XInterface >& xSource ) +{ + rtl::Reference< SdXImpressDocument > xModel( SdXImpressDocument::GetModel( pDocument ) ); + + if( xModel.is() ) + { + ::com::sun::star::document::EventObject aEvent( xSource, rEventName ); + xModel->notifyEvent(aEvent ); + } +} diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 21b12f9913a6..a1a8a4f4dabb 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -1007,6 +1007,9 @@ sal_Bool SdXShape::IsEmptyPresObj() const throw() if( pParaObj ) { delete pParaObj; + } + else + { return sal_True; } } diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 4a01c995544b..a252e2302b59 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -106,6 +106,12 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; using namespace ::com::sun::star::drawing; +using namespace ::com::sun::star::office; + +namespace sd { +extern Reference< XAnnotation > createAnnotation( const Reference< XComponentContext >& xContext, SdPage* ); +extern Reference< XAnnotationEnumeration > createAnnotationEnumeration( const sd::AnnotationVector& ); +} /* this are the ids for page properties */ enum WID_PAGE @@ -519,6 +525,10 @@ Any SAL_CALL SdGenericDrawPage::queryInterface( const uno::Type & rType ) else QUERYINT( drawing::XShapeCombiner ); else QUERYINT( drawing::XShapeBinder ); else QUERYINT( beans::XMultiPropertySet ); + else if( rType == ITYPE( office::XAnnotationAccess ) ) + { + return Any( Reference< office::XAnnotationAccess >( this ) ); + } else if( rType == ITYPE( XAnimationNodeSupplier ) ) { if( mbIsImpressDocument ) @@ -2036,7 +2046,7 @@ Sequence< uno::Type > SAL_CALL SdDrawPage::getTypes() throw(uno::RuntimeExceptio // Collect the types of this class. ::std::vector aTypes; - aTypes.reserve(11); + aTypes.reserve(13); aTypes.push_back(ITYPE(drawing::XDrawPage)); aTypes.push_back(ITYPE(beans::XPropertySet)); aTypes.push_back(ITYPE(container::XNamed)); @@ -2046,6 +2056,7 @@ Sequence< uno::Type > SAL_CALL SdDrawPage::getTypes() throw(uno::RuntimeExceptio aTypes.push_back(ITYPE(document::XLinkTargetSupplier)); aTypes.push_back(ITYPE( drawing::XShapeCombiner )); aTypes.push_back(ITYPE( drawing::XShapeBinder )); + aTypes.push_back(ITYPE( office::XAnnotationAccess )); aTypes.push_back(ITYPE( beans::XMultiPropertySet )); if( bPresPage ) aTypes.push_back(ITYPE(presentation::XPresentationPage)); @@ -2526,6 +2537,27 @@ void SdDrawPage::setBackground( const Any& rValue ) // pPage->SendRepaintBroadcast(); } +// XAnnotationAccess: +Reference< XAnnotation > SAL_CALL SdGenericDrawPage::createAndInsertAnnotation() throw (RuntimeException) +{ + if( !GetPage() ) + throw DisposedException(); + + Reference< XAnnotation > xRet; + GetPage()->createAnnotation(xRet); + return xRet; +} + +void SAL_CALL SdGenericDrawPage::removeAnnotation(const Reference< XAnnotation > & annotation) throw (RuntimeException, IllegalArgumentException) +{ + GetPage()->removeAnnotation(annotation); +} + +Reference< XAnnotationEnumeration > SAL_CALL SdGenericDrawPage::createAnnotationEnumeration() throw (RuntimeException) +{ + return ::sd::createAnnotationEnumeration( GetPage()->getAnnotations() ); +} + void SdDrawPage::getBackground( Any& rValue ) throw() { SdrObject* pObj = GetPage()->GetBackgroundObj(); @@ -2698,7 +2730,7 @@ Sequence< uno::Type > SAL_CALL SdMasterPage::getTypes() throw(uno::RuntimeExcept // Collect the types of this class. ::std::vector aTypes; - aTypes.reserve(10); + aTypes.reserve(12); aTypes.push_back(ITYPE(drawing::XDrawPage)); aTypes.push_back(ITYPE(beans::XPropertySet)); aTypes.push_back(ITYPE(container::XNamed)); @@ -2707,6 +2739,7 @@ Sequence< uno::Type > SAL_CALL SdMasterPage::getTypes() throw(uno::RuntimeExcept aTypes.push_back(ITYPE(document::XLinkTargetSupplier)); aTypes.push_back(ITYPE( drawing::XShapeCombiner )); aTypes.push_back(ITYPE( drawing::XShapeBinder )); + aTypes.push_back(ITYPE( office::XAnnotationAccess )); aTypes.push_back(ITYPE( beans::XMultiPropertySet )); if( bPresPage ) aTypes.push_back(ITYPE(presentation::XPresentationPage)); diff --git a/sd/source/ui/unoidl/unopage.hxx b/sd/source/ui/unoidl/unopage.hxx index c9d3aec46df5..a1d9e0436e98 100644 --- a/sd/source/ui/unoidl/unopage.hxx +++ b/sd/source/ui/unoidl/unopage.hxx @@ -37,6 +37,8 @@ #include #include #include +#include + #include #ifndef _SVX_UNOPAGE_HXX @@ -69,6 +71,7 @@ class SdGenericDrawPage : public SvxFmDrawPage, public ::com::sun::star::beans::XPropertySet, public ::com::sun::star::beans::XMultiPropertySet, public ::com::sun::star::animations::XAnimationNodeSupplier, + public ::com::sun::star::office::XAnnotationAccess, public ::com::sun::star::document::XLinkTargetSupplier { private: @@ -158,6 +161,11 @@ public: // XAnimationNodeSupplier virtual ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > SAL_CALL getAnimationNode( ) throw (::com::sun::star::uno::RuntimeException); + + // XAnnotationAccess: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > SAL_CALL createAndInsertAnnotation() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeAnnotation(const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > & annotation) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotationEnumeration > SAL_CALL createAnnotationEnumeration() throw (::com::sun::star::uno::RuntimeException); }; /*********************************************************************** diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index 556154136152..b6459b58a87f 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -1230,6 +1230,8 @@ BOOL DrawViewShell::SwitchPage(USHORT nSelectedPage) rBindings.Invalidate(SID_NAVIGATOR_PAGENAME, TRUE, FALSE); rBindings.Invalidate(SID_STATUS_PAGE, TRUE, FALSE); UpdatePreview( mpActualPage ); + + mpDrawView->AdjustMarkHdl(); } return (bOK); diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index d63c30101063..85706fb9cbb6 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -502,6 +502,9 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) if ( !IsInputLocked() ) { + if( GetView() &&GetView()->getSmartTags().Command(rCEvt) ) + return; + const bool bNativeShow (SlideShow::IsRunning(GetViewShellBase())); if( rCEvt.GetCommand() == COMMAND_PASTESELECTION && !bNativeShow ) diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 4641752afe5c..3c396db7207d 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -83,6 +83,7 @@ #include "SdUnoDrawView.hxx" #include "slideshow.hxx" #include "ToolBarManager.hxx" +#include "annotationmanager.hxx" using namespace ::rtl; using namespace ::com::sun::star; @@ -138,15 +139,10 @@ void SAL_CALL ScannerEventListener::disposing( const ::com::sun::star::lang::Eve |* \************************************************************************/ -DrawViewShell::DrawViewShell ( - SfxViewFrame* pFrame, - ViewShellBase& rViewShellBase, - ::Window* pParentWindow, - PageKind ePageKind, - FrameView* pFrameViewArgument) - : ViewShell (pFrame, pParentWindow, rViewShellBase), - maTabControl(this, pParentWindow), - mbIsInSwitchPage(false) +DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, PageKind ePageKind, FrameView* pFrameViewArgument ) +: ViewShell (pFrame, pParentWindow, rViewShellBase) +, maTabControl(this, pParentWindow) +, mbIsInSwitchPage(false) { if (pFrameViewArgument != NULL) mpFrameView = pFrameViewArgument; @@ -161,13 +157,10 @@ DrawViewShell::DrawViewShell ( |* \************************************************************************/ -DrawViewShell::DrawViewShell ( - SfxViewFrame* pFrame, - ::Window* pParentWindow, - const DrawViewShell& rShell) - : ViewShell(pFrame, pParentWindow, rShell), - maTabControl(this, pParentWindow), - mbIsInSwitchPage(false) +DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ::Window* pParentWindow, const DrawViewShell& rShell ) +: ViewShell(pFrame, pParentWindow, rShell) +, maTabControl(this, pParentWindow) +, mbIsInSwitchPage(false) { mpFrameView = new FrameView(GetDoc()); Construct (GetDocSh(), PK_STANDARD); @@ -181,6 +174,8 @@ DrawViewShell::DrawViewShell ( DrawViewShell::~DrawViewShell() { + mpAnnotationManager.release(); + OSL_ASSERT (GetViewShell()!=NULL); if( mxScannerListener.is() ) @@ -422,6 +417,8 @@ void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind) ::com::sun::star::uno::UNO_QUERY ); } } + + mpAnnotationManager.reset( new AnnotationManager( GetViewShellBase() ) ); } @@ -859,5 +856,19 @@ void DrawViewShell::Notify (SfxBroadcaster&, const SfxHint& rHint) } +void DrawViewShell::ExecuteAnnotation (SfxRequest& rRequest) +{ + if( mpAnnotationManager.get() ) + mpAnnotationManager->ExecuteAnnotation( rRequest ); +} + +// -------------------------------------------------------------------- + +void DrawViewShell::GetAnnotationState (SfxItemSet& rItemSet ) +{ + if( mpAnnotationManager.get() ) + mpAnnotationManager->GetAnnotationState( rItemSet ); +} + } // end of namespace sd diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx index 4b2fd76f7bea..0349388577eb 100644 --- a/sd/source/ui/view/viewshe2.cxx +++ b/sd/source/ui/view/viewshe2.cxx @@ -798,7 +798,10 @@ BOOL ViewShell::RequestHelp(const HelpEvent& rHEvt, ::sd::Window*) if (rHEvt.GetMode()) { - if(HasCurrentFunction()) + if( GetView() ) + bReturn = GetView()->getSmartTags().RequestHelp(rHEvt); + + if(!bReturn && HasCurrentFunction()) { bReturn = GetCurrentFunction()->RequestHelp(rHEvt); } diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index c179385f1c2e..208d5426c8bd 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -665,9 +665,18 @@ void ViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONT ); GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); } - else if(HasCurrentFunction()) + else { - GetCurrentFunction()->Command(rCEvt); + bool bConsumed = false; + if( GetView() ) + { + bConsumed = GetView()->getSmartTags().Command(rCEvt); + } + + if( !bConsumed && HasCurrentFunction()) + { + GetCurrentFunction()->Command(rCEvt); + } } } } diff --git a/sd/uiconfig/sdraw/accelerator/de/default.xml b/sd/uiconfig/sdraw/accelerator/de/default.xml deleted file mode 100644 index aeb60003de1c..000000000000 --- a/sd/uiconfig/sdraw/accelerator/de/default.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sd/uiconfig/sdraw/accelerator/en-GB/default.xml b/sd/uiconfig/sdraw/accelerator/en-GB/default.xml deleted file mode 100644 index 3219cbbc1f02..000000000000 --- a/sd/uiconfig/sdraw/accelerator/en-GB/default.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sd/uiconfig/sdraw/accelerator/en-US/default.xml b/sd/uiconfig/sdraw/accelerator/en-US/default.xml deleted file mode 100644 index 3219cbbc1f02..000000000000 --- a/sd/uiconfig/sdraw/accelerator/en-US/default.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sd/uiconfig/sdraw/accelerator/es/default.xml b/sd/uiconfig/sdraw/accelerator/es/default.xml deleted file mode 100644 index ae40f1ae35d6..000000000000 --- a/sd/uiconfig/sdraw/accelerator/es/default.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sd/uiconfig/sdraw/accelerator/fr/default.xml b/sd/uiconfig/sdraw/accelerator/fr/default.xml deleted file mode 100644 index b231ba598b7a..000000000000 --- a/sd/uiconfig/sdraw/accelerator/fr/default.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml index e34baec0f29c..8f5cebde373d 100644 --- a/sd/uiconfig/sdraw/menubar/menubar.xml +++ b/sd/uiconfig/sdraw/menubar/menubar.xml @@ -105,7 +105,8 @@ - + + @@ -130,8 +131,9 @@ - - + + + diff --git a/sd/uiconfig/sdraw/toolbar/commentsbar.xml b/sd/uiconfig/sdraw/toolbar/commentsbar.xml new file mode 100644 index 000000000000..07c42d262758 --- /dev/null +++ b/sd/uiconfig/sdraw/toolbar/commentsbar.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/sd/uiconfig/simpress/accelerator/de/default.xml b/sd/uiconfig/simpress/accelerator/de/default.xml deleted file mode 100644 index bd9b3b4cdf4c..000000000000 --- a/sd/uiconfig/simpress/accelerator/de/default.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/sd/uiconfig/simpress/accelerator/default.xml b/sd/uiconfig/simpress/accelerator/default.xml deleted file mode 100644 index 045a72517ae5..000000000000 --- a/sd/uiconfig/simpress/accelerator/default.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sd/uiconfig/simpress/accelerator/es/default.xml b/sd/uiconfig/simpress/accelerator/es/default.xml deleted file mode 100644 index 07a116472c7d..000000000000 --- a/sd/uiconfig/simpress/accelerator/es/default.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/sd/uiconfig/simpress/accelerator/fr/default.xml b/sd/uiconfig/simpress/accelerator/fr/default.xml deleted file mode 100644 index 28a99ac3ce09..000000000000 --- a/sd/uiconfig/simpress/accelerator/fr/default.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml index ece53ad4c918..ead8960586dc 100644 --- a/sd/uiconfig/simpress/menubar/menubar.xml +++ b/sd/uiconfig/simpress/menubar/menubar.xml @@ -119,7 +119,8 @@ - + + @@ -147,7 +148,8 @@ - + + @@ -282,7 +284,7 @@ - + diff --git a/sd/uiconfig/simpress/toolbar/commentsbar.xml b/sd/uiconfig/simpress/toolbar/commentsbar.xml new file mode 100644 index 000000000000..07c42d262758 --- /dev/null +++ b/sd/uiconfig/simpress/toolbar/commentsbar.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/sd/util/hidother.src b/sd/util/hidother.src index b6f427e9488a..898079e5c762 100644 --- a/sd/util/hidother.src +++ b/sd/util/hidother.src @@ -143,6 +143,7 @@ hidspecial HID_SD_ALL_MASTERS { HelpId = HID_SD_ALL_MASTERS; }; hidspecial HID_SD_SLIDE_LAYOUTS { HelpId = HID_SD_SLIDE_LAYOUTS; }; hidspecial HID_SD_CUSTOM_ANIMATIONS { HelpId = HID_SD_CUSTOM_ANIMATIONS; }; hidspecial HID_SD_SLIDE_TRANSITIONS { HelpId = HID_SD_SLIDE_TRANSITIONS; }; +hidspecial HID_SD_ANNOTATIONS { HelpId = HID_SD_ANNOTATIONS; }; hidspecial HID_SD_CUSTOMANIMATIONPANE_PB_ADD_EFFECT { HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_ADD_EFFECT; }; hidspecial HID_SD_CUSTOMANIMATIONPANE_PB_CHANGE_EFFECT { HelpId = HID_SD_CUSTOMANIMATIONPANE_PB_CHANGE_EFFECT; }; @@ -204,3 +205,5 @@ hidspecial HID_SD_RULER_HORIZONTAL { HelpId = HID_S hidspecial HID_SD_RULER_VERTICAL { HelpId = HID_SD_RULER_VERTICAL; }; hidspecial HID_SD_TABLE_DESIGN { HelpId = HID_SD_TABLE_DESIGN; }; +hidspecial HID_SD_ANNOTATIONS { HelpId = HID_SD_ANNOTATIONS; }; + diff --git a/sd/util/makefile.mk b/sd/util/makefile.mk index 0b84a957d046..cf9a516094b7 100644 --- a/sd/util/makefile.mk +++ b/sd/util/makefile.mk @@ -55,6 +55,7 @@ RESLIB1SRSFILES=\ $(SRS)$/animui.srs \ $(SRS)$/slideshow.srs \ $(SRS)$/uitable.srs \ + $(SRS)$/uiannotations.srs \ $(SOLARCOMMONRESDIR)$/sfx.srs # --- StarDraw DLL @@ -119,10 +120,13 @@ LIB3FILES= \ $(SLB)$/dlg.lib \ $(SLB)$/core.lib \ $(SLB)$/undo.lib \ + $(SLB)$/annotations.lib \ + $(SLB)$/text.lib \ $(SLB)$/helper.lib \ $(SLB)$/xml.lib \ $(SLB)$/cgm.lib \ $(SLB)$/uitable.lib \ + $(SLB)$/uiannotations.lib\ $(SLB)$/grf.lib LIB5TARGET=$(SLB)$/sdraw3_2.lib -- cgit v1.2.3 From c01901076f65097060edf52eb73431a4052d4a0a Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Fri, 18 Sep 2009 10:15:03 +0000 Subject: CWS-TOOLING: integrate CWS mba32issues02 2009-09-17 mb93783 merge commit 2009-09-03 tb121644 #i104748 - slot unification to .uno:PasteSpecial 2009-09-01 mba #101455#: code simplification 2009-08-31 mb93783 iso locales for norwegian builds are nb and nn, not no 2009-08-25 mba merge to m55 2009-07-29 mba cleanup after rebase 2009-07-29 mba #i103200#: wrong order of first and last name in CJK UI 2009-07-27 mba adding dictionary changes from broken svn CWS 2009-07-27 mba adding dictionary changes from broken svn CWS 2009-07-27 mba apply patch from broken svn CWS --- sd/inc/app.hrc | 2 -- sd/sdi/SlideSorterController.sdi | 4 +-- sd/sdi/_drvwsh.sdi | 4 +-- sd/sdi/makefile.mk | 18 ++++++------ sd/sdi/sdraw.sdi | 32 ++-------------------- sd/source/ui/app/app.src | 20 -------------- sd/source/ui/app/makefile.mk | 2 +- .../slidesorter/controller/SlsSelectionManager.cxx | 2 ++ .../ui/slidesorter/controller/SlsSlotManager.cxx | 12 ++++---- sd/source/ui/view/PrintManager.cxx | 4 +++ sd/source/ui/view/ViewShellBase.cxx | 27 +----------------- sd/source/ui/view/drviews1.cxx | 7 +++-- sd/source/ui/view/drviews7.cxx | 8 +++--- sd/source/ui/view/drviews8.cxx | 2 +- sd/source/ui/view/outlnvsh.cxx | 2 +- sd/uiconfig/sdraw/menubar/menubar.xml | 2 +- sd/uiconfig/simpress/menubar/menubar.xml | 2 +- 17 files changed, 44 insertions(+), 106 deletions(-) (limited to 'sd/sdi') diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index d1852a5e9992..0ccbbf921b6b 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -38,7 +38,6 @@ #define SID_BACKGROUND (SID_SD_START) #define SID_LASTVERSION (SID_SD_START+1) #define SID_PAGESETUP (SID_SD_START+2) -#define SID_PASTE2 (SID_SD_START+3) #define SID_COPYOBJECTS (SID_SD_START+4) #define SID_MANAGE_LINKS (SID_SD_START+5) #define SID_CHOOSE (SID_SD_START+7) @@ -112,7 +111,6 @@ #define SID_DISMANTLE (SID_SD_START+82) #define SID_SD_HELP_PI (SID_SD_START+83) #define SID_TIPHELP (SID_SD_START+84) -#define SID_OBJECT_MIRROR (SID_SD_START+85) #define SID_STATUS_PAGE (SID_SD_START+86) #define SID_STATUS_LAYOUT (SID_SD_START+87) #define SID_STATUS_SELMODE (SID_SD_START+88) diff --git a/sd/sdi/SlideSorterController.sdi b/sd/sdi/SlideSorterController.sdi index be2a86160124..ff64d80bd8af 100644 --- a/sd/sdi/SlideSorterController.sdi +++ b/sd/sdi/SlideSorterController.sdi @@ -128,7 +128,7 @@ interface SlideSorterView ExecMethod = FuSupport ; StateMethod = GetClipboardState ; ] - SID_PASTE2 // ole : no, status : ? + SID_PASTE_SPECIAL // ole : no, status : ? [ ExecMethod = FuSupport ; StateMethod = GetClipboardState ; @@ -199,7 +199,7 @@ interface SlideSorterView GroupId = GID_DOCUMENT ; ExecMethod = ExecCtrl ; StateMethod = GetCtrlState ; - Asynchron , Volatile , AutoUpdate , + Asynchron , AutoUpdate , MenuConfig , AccelConfig , ToolBoxConfig ; ] SID_SEARCH_DLG // ole : no, status : ? diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi index 8f758dda5858..b641ab64a1a0 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -62,7 +62,7 @@ interface DrawView GroupId = GID_DOCUMENT ; ExecMethod = ExecCtrl ; StateMethod = GetCtrlState ; - Asynchron , Volatile , AutoUpdate , + Asynchron , AutoUpdate , MenuConfig , AccelConfig , ToolBoxConfig ; ] SID_PAGEMODE // ole : no, status : play rec @@ -281,7 +281,7 @@ interface DrawView StateMethod = GetMenuState ; ] - SID_PASTE2 // ole : no, status : ? + SID_PASTE_SPECIAL // ole : no, status : ? [ ExecMethod = FuTemporary ; StateMethod = GetMenuState ; diff --git a/sd/sdi/makefile.mk b/sd/sdi/makefile.mk index f49d5103e2f5..8a2c8fd971d7 100644 --- a/sd/sdi/makefile.mk +++ b/sd/sdi/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite @@ -56,17 +56,18 @@ SVSDI1DEPEND= \ _docsh.sdi \ docshell.sdi \ drtxtob.sdi \ - drbezob.sdi \ - drgrfob.sdi \ + drbezob.sdi \ + drgrfob.sdi \ _drvwsh.sdi \ drviewsh.sdi \ - mediaob.sdi \ - tables.sdi\ + mediaob.sdi \ + tables.sdi\ outlnvsh.sdi \ SlideSorterController.sdi \ ViewShellBase.sdi \ TaskPaneViewShell.sdi \ sdslots.hrc \ + $(SOLARINCXDIR)$/svxslots.ilb \ $(PRJ)$/inc$/app.hrc SVSDI2DEPEND= \ @@ -75,15 +76,16 @@ SVSDI2DEPEND= \ _docsh.sdi \ grdocsh.sdi \ drtxtob.sdi \ - drbezob.sdi \ - drgrfob.sdi \ + drbezob.sdi \ + drgrfob.sdi \ _drvwsh.sdi \ grviewsh.sdi \ - mediaob.sdi \ + mediaob.sdi \ outlnvsh.sdi \ ViewShellBase.sdi \ TaskPaneViewShell.sdi \ sdslots.hrc \ + $(SOLARINCXDIR)$/svxslots.ilb \ $(PRJ)$/inc$/app.hrc # --- Targets ------------------------------------------------------- diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi index 515b5b6b84ce..7c37e455276c 100644 --- a/sd/sdi/sdraw.sdi +++ b/sd/sdi/sdraw.sdi @@ -339,7 +339,6 @@ SfxVoidItem Break SID_BREAK GroupId = GID_MODIFY; ] -//-------------------------------------------------------------------------- SfxVoidItem CapturePoint SID_CAPTUREPOINT () [ @@ -1921,7 +1920,7 @@ SfxVoidItem DeleteLayer SID_DELETE_LAYER [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = TRUE, @@ -1946,7 +1945,7 @@ SfxVoidItem DeletePage SID_DELETE_PAGE [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = TRUE, @@ -5260,31 +5259,6 @@ SfxBoolItem ParaspaceIncrease SID_PARASPACE_INCREASE GroupId = GID_FORMAT; ] -//-------------------------------------------------------------------------- -SfxVoidItem PasteClipboard SID_PASTE2 -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Volatile, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - //-------------------------------------------------------------------------- SfxBoolItem PickThrough SID_PICK_THROUGH @@ -6772,7 +6746,7 @@ SfxVoidItem DeleteMasterPage SID_DELETE_MASTER_PAGE() [ /* flags: */ AutoUpdate = FALSE, - Cachable = Volatile, + Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, HasDialog = TRUE, diff --git a/sd/source/ui/app/app.src b/sd/source/ui/app/app.src index c8991caffd51..957cd6c25f53 100644 --- a/sd/source/ui/app/app.src +++ b/sd/source/ui/app/app.src @@ -36,23 +36,3 @@ #include "misc.hxx" #include -// -// Acceleratorn -// - -// -// Menu -// - -// Menu (Impress) -#include "menu.src" -#include "menuportal.src" - -// Menu (Draw (Graphic)) -#undef SD_MENU -#define SD_MENU RID_GRAPHIC_DEFAULTMENU -#undef SD_MENU_PORTAL -#define SD_MENU_PORTAL RID_GRAPHIC_PORTALMENU - -#include "menu.src" -#include "menuportal.src" diff --git a/sd/source/ui/app/makefile.mk b/sd/source/ui/app/makefile.mk index af9e230704cb..82a6177a9e95 100644 --- a/sd/source/ui/app/makefile.mk +++ b/sd/source/ui/app/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx index f1d3162ca034..2eac8b757780 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx @@ -292,6 +292,8 @@ void SelectionManager::SelectionHasChanged (const bool bMakeSelectionVisible) pViewShell->Invalidate (SID_SUMMARY_PAGE); pViewShell->Invalidate(SID_SHOW_SLIDE); pViewShell->Invalidate(SID_HIDE_SLIDE); + pViewShell->Invalidate(SID_DELETE_PAGE); + pViewShell->Invalidate(SID_DELETE_MASTER_PAGE); // StatusBar pViewShell->Invalidate (SID_STATUS_PAGE); diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index a9a4d6b2d385..ba8dbb278ca4 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -703,13 +703,13 @@ void SlotManager::GetClipboardState ( SfxItemSet& rSet) SdTransferable* pTransferClip = SD_MOD()->pTransferClip; if (rSet.GetItemState(SID_PASTE) == SFX_ITEM_AVAILABLE - || rSet.GetItemState(SID_PASTE2) == SFX_ITEM_AVAILABLE) + || rSet.GetItemState(SID_PASTE_SPECIAL) == SFX_ITEM_AVAILABLE) { // Keine eigenen Clipboard-Daten? if ( !pTransferClip || !pTransferClip->GetDocShell() ) { rSet.DisableItem(SID_PASTE); - rSet.DisableItem(SID_PASTE2); + rSet.DisableItem(SID_PASTE_SPECIAL); } else { @@ -739,7 +739,7 @@ void SlotManager::GetClipboardState ( SfxItemSet& rSet) if ( ! bIsPastingSupported) { rSet.DisableItem(SID_PASTE); - rSet.DisableItem(SID_PASTE2); + rSet.DisableItem(SID_PASTE_SPECIAL); } } } @@ -748,7 +748,7 @@ void SlotManager::GetClipboardState ( SfxItemSet& rSet) // Cut, copy and paste of master pages is not yet implemented properly if (rSet.GetItemState(SID_COPY) == SFX_ITEM_AVAILABLE || rSet.GetItemState(SID_PASTE) == SFX_ITEM_AVAILABLE - || rSet.GetItemState(SID_PASTE2) == SFX_ITEM_AVAILABLE + || rSet.GetItemState(SID_PASTE_SPECIAL) == SFX_ITEM_AVAILABLE || rSet.GetItemState(SID_CUT) == SFX_ITEM_AVAILABLE) { if (mrSlideSorter.GetModel().GetEditMode() == EM_MASTERPAGE) @@ -759,8 +759,8 @@ void SlotManager::GetClipboardState ( SfxItemSet& rSet) rSet.DisableItem(SID_COPY); if (rSet.GetItemState(SID_PASTE) == SFX_ITEM_AVAILABLE) rSet.DisableItem(SID_PASTE); - if (rSet.GetItemState(SID_PASTE2) == SFX_ITEM_AVAILABLE) - rSet.DisableItem(SID_PASTE2); + if (rSet.GetItemState(SID_PASTE_SPECIAL) == SFX_ITEM_AVAILABLE) + rSet.DisableItem(SID_PASTE_SPECIAL); } } diff --git a/sd/source/ui/view/PrintManager.cxx b/sd/source/ui/view/PrintManager.cxx index 5056d48b2e8e..797518473ebd 100644 --- a/sd/source/ui/view/PrintManager.cxx +++ b/sd/source/ui/view/PrintManager.cxx @@ -161,6 +161,10 @@ USHORT PrintManager::SetPrinterOptDlg ( USHORT nDiffFlags, BOOL _bShowDialog) { + SfxPrinter* pOld = mrBase.GetDocShell()->GetPrinter( FALSE ); + if ( pOld && pOld->IsPrinting() ) + return SFX_PRINTERROR_BUSY; + mrBase.GetDocShell()->SetPrinter(pNewPrinter); if ( (nDiffFlags & SFX_PRINTER_CHG_ORIENTATION || diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 2cf8164743a6..25fca9e0bae7 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -503,32 +503,7 @@ void ViewShellBase::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) } break; - case SFX_EVENT_CREATEDOC: - // mpPaneManager->InitPanes(); - break; - - case SFX_EVENT_ACTIVATEDOC: - break; - - case SFX_EVENT_STARTAPP: - case SFX_EVENT_CLOSEAPP: - case SFX_EVENT_CLOSEDOC: - case SFX_EVENT_SAVEDOC: - case SFX_EVENT_SAVEASDOC: - case SFX_EVENT_DEACTIVATEDOC: - case SFX_EVENT_PRINTDOC: - case SFX_EVENT_ONERROR: - case SFX_EVENT_LOADFINISHED: - case SFX_EVENT_SAVEFINISHED: - case SFX_EVENT_MODIFYCHANGED: - case SFX_EVENT_PREPARECLOSEDOC: - case SFX_EVENT_NEWMESSAGE: - case SFX_EVENT_TOGGLEFULLSCREENMODE: - case SFX_EVENT_SAVEDOCDONE: - case SFX_EVENT_SAVEASDOCDONE: - case SFX_EVENT_MOUSEOVER_OBJECT: - case SFX_EVENT_MOUSECLICK_OBJECT: - case SFX_EVENT_MOUSEOUT_OBJECT: + default: break; } } diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index b6459b58a87f..2077a852f960 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -165,8 +165,6 @@ void DrawViewShell::Deactivate(BOOL bIsMDIActivate) void DrawViewShell::SelectionHasChanged (void) { - // Um die Performance zu steigern wird jetzt die komplette - // Shell invalidiert statt alle Slots einzeln Invalidate(); //Update3DWindow(); // 3D-Controller @@ -492,6 +490,8 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) Invalidate( SID_PAGEMODE ); Invalidate( SID_LAYERMODE ); Invalidate( SID_MASTERPAGE ); + Invalidate( SID_DELETE_MASTER_PAGE ); + Invalidate( SID_DELETE_PAGE ); Invalidate( SID_SLIDE_MASTERPAGE ); Invalidate( SID_TITLE_MASTERPAGE ); Invalidate( SID_NOTES_MASTERPAGE ); @@ -1229,6 +1229,8 @@ BOOL DrawViewShell::SwitchPage(USHORT nSelectedPage) SfxBindings& rBindings = GetViewFrame()->GetBindings(); rBindings.Invalidate(SID_NAVIGATOR_PAGENAME, TRUE, FALSE); rBindings.Invalidate(SID_STATUS_PAGE, TRUE, FALSE); + rBindings.Invalidate(SID_DELETE_MASTER_PAGE, TRUE, FALSE); + rBindings.Invalidate(SID_DELETE_PAGE, TRUE, FALSE); UpdatePreview( mpActualPage ); mpDrawView->AdjustMarkHdl(); @@ -1358,6 +1360,7 @@ void DrawViewShell::ResetActualLayer() pLayerBar->SetCurPageId(nActiveLayer + 1); GetViewFrame()->GetBindings().Invalidate( SID_MODIFYLAYER ); + GetViewFrame()->GetBindings().Invalidate( SID_DELETE_LAYER ); } } diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index d6629a784688..983033be7b8c 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -210,7 +210,7 @@ IMPL_LINK( DrawViewShell, ClipboardChanged, TransferableDataHelper*, pDataHelper SfxBindings& rBindings = GetViewFrame()->GetBindings(); rBindings.Invalidate( SID_PASTE ); - rBindings.Invalidate( SID_PASTE2 ); + rBindings.Invalidate( SID_PASTE_SPECIAL ); rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS ); } return 0; @@ -570,7 +570,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) // clipboard (paste) if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE ) || - SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE2 ) || + SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE_SPECIAL ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) ) { if ( !mpClipEvtLstnr ) @@ -596,7 +596,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) if( !mbPastePossible ) { rSet.DisableItem( SID_PASTE ); - rSet.DisableItem( SID_PASTE2 ); + rSet.DisableItem( SID_PASTE_SPECIAL ); rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS ); } else if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) ) @@ -1017,7 +1017,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) SD_MOD()->GetWaterCan() ) { rSet.DisableItem( SID_PASTE ); - rSet.DisableItem( SID_PASTE2 ); + rSet.DisableItem( SID_PASTE_SPECIAL ); rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS ); rSet.DisableItem( SID_INSERT_FLD_DATE_FIX ); diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx index d2ea0daf06b7..047c1f90f3d5 100644 --- a/sd/source/ui/view/drviews8.cxx +++ b/sd/source/ui/view/drviews8.cxx @@ -167,7 +167,7 @@ void DrawViewShell::FuTemp01(SfxRequest& rReq) } break; - case SID_PASTE2: + case SID_PASTE_SPECIAL: { SetCurrentFunction( FuInsertClipboard::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); Cancel(); diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index d4f921d369dc..d14f6ed9dc34 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -793,7 +793,7 @@ IMPL_LINK( OutlineViewShell, ClipboardChanged, TransferableDataHelper*, pDataHel SfxBindings& rBindings = GetViewFrame()->GetBindings(); rBindings.Invalidate( SID_PASTE ); - rBindings.Invalidate( SID_PASTE2 ); + rBindings.Invalidate( SID_PASTE_SPECIAL ); rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS ); } return 0; diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml index 8f5cebde373d..fcc7246bb427 100644 --- a/sd/uiconfig/sdraw/menubar/menubar.xml +++ b/sd/uiconfig/sdraw/menubar/menubar.xml @@ -52,7 +52,7 @@ - + diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml index ead8960586dc..d762a075abd4 100644 --- a/sd/uiconfig/simpress/menubar/menubar.xml +++ b/sd/uiconfig/simpress/menubar/menubar.xml @@ -54,7 +54,7 @@ - + -- cgit v1.2.3 From acb87ad24c0e041a3e934613ca754869844d5c23 Mon Sep 17 00:00:00 2001 From: Release Engineers Date: Mon, 21 Sep 2009 12:27:31 +0000 Subject: #i10000# solve unres. externals --- sd/sdi/drviewsh.sdi | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'sd/sdi') diff --git a/sd/sdi/drviewsh.sdi b/sd/sdi/drviewsh.sdi index 59f493703e74..603a6036d711 100644 --- a/sd/sdi/drviewsh.sdi +++ b/sd/sdi/drviewsh.sdi @@ -181,8 +181,10 @@ interface ImpressEditView : DrawView StateMethod = GetMenuState ; ] } -interface Annotation + +shell DrawViewShell { + import ImpressEditView[Automation]; SID_INSERT_POSTIT [ ExecMethod = ExecuteAnnotation; @@ -225,12 +227,6 @@ interface Annotation ] } -shell DrawViewShell -{ - import ImpressEditView[Automation]; - import Annotation; -} - shell PresentationViewShell { -- cgit v1.2.3