diff options
Diffstat (limited to 'sd/source/ui/annotations')
-rw-r--r-- | sd/source/ui/annotations/annotationmanager.cxx | 254 | ||||
-rw-r--r-- | sd/source/ui/annotations/annotationmanagerimpl.hxx | 36 | ||||
-rw-r--r-- | sd/source/ui/annotations/annotations.hrc | 52 | ||||
-rw-r--r-- | sd/source/ui/annotations/annotations.src | 6 | ||||
-rw-r--r-- | sd/source/ui/annotations/annotationtag.cxx | 98 | ||||
-rw-r--r-- | sd/source/ui/annotations/annotationtag.hxx | 14 | ||||
-rw-r--r-- | sd/source/ui/annotations/annotationwindow.cxx | 46 | ||||
-rw-r--r-- | sd/source/ui/annotations/annotationwindow.hxx | 90 |
8 files changed, 298 insertions, 298 deletions
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index a6a1ae2051fb..64e1046178fb 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -152,12 +152,12 @@ static SfxDispatcher* getDispatcher( ViewShellBase& rBase ) } 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 ); + 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 ) @@ -169,7 +169,7 @@ OUString getAnnotationDateTimeString( const Reference< XAnnotation >& xAnnotatio const LocaleDataWrapper& rLocalData = aSysLocale.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)); @@ -179,8 +179,8 @@ OUString getAnnotationDateTimeString( const Reference< XAnnotation >& xAnnotatio else if (aDate.IsValid() ) sRet = sRet + rLocalData.getDate(aDate); - - Time aTime( aDateTime.Hours, aDateTime.Minutes, aDateTime.Seconds, aDateTime.HundredthSeconds ); + + Time aTime( aDateTime.Hours, aDateTime.Minutes, aDateTime.Seconds, aDateTime.HundredthSeconds ); if(aTime.GetTime() != 0) sRet = sRet + rtl::OUString::createFromAscii(" ") + rLocalData.getTime( aTime,false ); } @@ -198,7 +198,7 @@ AnnotationManagerImpl::AnnotationManagerImpl( ViewShellBase& rViewShellBase ) { SdOptions* pOptions = SD_MOD()->GetSdOptions(mpDoc->GetDocumentType()); if( pOptions ) - mbShowAnnotations = pOptions->IsShowComments() == TRUE; + mbShowAnnotations = pOptions->IsShowComments() == TRUE; } // -------------------------------------------------------------------- @@ -208,7 +208,7 @@ void AnnotationManagerImpl::init() // get current controller and initialize listeners try { - addListener(); + addListener(); mxView = Reference< XDrawView >::query(mrBase.GetController()); } catch( Exception& e ) @@ -225,7 +225,7 @@ void AnnotationManagerImpl::init() } catch( Exception& ) { - } + } } // -------------------------------------------------------------------- @@ -241,7 +241,7 @@ void SAL_CALL AnnotationManagerImpl::disposing () } catch( Exception& ) { - } + } removeListener(); DisposeTags(); @@ -257,7 +257,7 @@ void SAL_CALL AnnotationManagerImpl::disposing () } // -------------------------------------------------------------------- - + // XEventListener void SAL_CALL AnnotationManagerImpl::notifyEvent( const ::com::sun::star::document::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException) { @@ -282,9 +282,9 @@ void AnnotationManagerImpl::ShowAnnotations( bool bShow ) SdOptions* pOptions = SD_MOD()->GetSdOptions(mpDoc->GetDocumentType()); if( pOptions ) - pOptions->SetShowComments( mbShowAnnotations ? sal_True : sal_False ); - - UpdateTags(); + pOptions->SetShowComments( mbShowAnnotations ? sal_True : sal_False ); + + UpdateTags(); } } @@ -305,7 +305,7 @@ void AnnotationManagerImpl::ExecuteAnnotation(SfxRequest& rReq ) case SID_PREVIOUS_POSTIT: case SID_NEXT_POSTIT: SelectNextAnnotation( rReq.GetSlot() == SID_NEXT_POSTIT ); - break; + break; case SID_REPLYTO_POSTIT: ExecuteReplyToAnnotation( rReq ); break; @@ -320,7 +320,7 @@ void AnnotationManagerImpl::ExecuteAnnotation(SfxRequest& rReq ) void AnnotationManagerImpl::ExecuteInsertAnnotation(SfxRequest& /*rReq*/) { ShowAnnotations(true); - InsertAnnotation(); + InsertAnnotation(); } // -------------------------------------------------------------------- @@ -330,7 +330,7 @@ void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest& rReq) ShowAnnotations( true ); const SfxItemSet* pArgs = rReq.GetArgs(); - + switch( rReq.GetSlot() ) { case SID_DELETEALL_POSTIT: @@ -347,12 +347,12 @@ void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest& rReq) } } break; - case SID_DELETE_POSTIT: - { + case SID_DELETE_POSTIT: + { Reference< XAnnotation > xAnnotation; if( rReq.GetSlot() == SID_DELETE_POSTIT ) - { + { if( pArgs ) { const SfxPoolItem* pPoolItem = NULL; @@ -360,10 +360,10 @@ void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest& rReq) ( ( const SfxUnoAnyItem* ) pPoolItem )->GetValue() >>= xAnnotation; } } - - if( !xAnnotation.is() ) + + if( !xAnnotation.is() ) GetSelectedAnnotation( xAnnotation ); - + DeleteAnnotation( xAnnotation ); } break; @@ -381,23 +381,23 @@ void AnnotationManagerImpl::InsertAnnotation() { 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() ); @@ -405,14 +405,14 @@ void AnnotationManagerImpl::InsertAnnotation() 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; @@ -420,32 +420,32 @@ void AnnotationManagerImpl::InsertAnnotation() { 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 ); } @@ -469,7 +469,7 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest& rReq ) if( pTextApi ) { std::auto_ptr< ::Outliner > pOutliner( new ::Outliner(GetAnnotationPool(),OUTLINERMODE_TEXTOBJECT) ); - + mpDoc->SetCalcFieldValueHdl( pOutliner.get() ); pOutliner->SetUpdateMode( TRUE ); @@ -477,7 +477,7 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest& rReq ) OUString sAuthor( xAnnotation->getAuthor() ); if( sAuthor.getLength() == 0 ) sAuthor = String( SdResId( STR_ANNOTATION_NOAUTHOR ) ); - + aStr.SearchAndReplaceAscii("%1", sAuthor); aStr.Append( String(RTL_CONSTASCII_USTRINGPARAM(" (") ) ); @@ -490,32 +490,32 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest& rReq ) 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)); - + 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() ); + xAnnotation->setAuthor( aUserOptions.GetFullName() ); // set current time to reply xAnnotation->setDateTime( getCurrentDateTime() ); - + UpdateTags(true); SelectAnnotation( xAnnotation, true ); } @@ -524,7 +524,7 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest& rReq ) // -------------------------------------------------------------------- void AnnotationManagerImpl::DeleteAnnotation( Reference< XAnnotation > xAnnotation ) -{ +{ SdPage* pPage = GetCurrentPage(); if( xAnnotation.is() && pPage ) @@ -550,9 +550,9 @@ void AnnotationManagerImpl::DeleteAnnotationsByAuthor( const rtl::OUString& sAut do { pPage = GetNextPage( pPage, true ); - + if( pPage && !pPage->getAnnotations().empty() ) - { + { AnnotationVector aAnnotations( pPage->getAnnotations() ); for( AnnotationVector::iterator iter = aAnnotations.begin(); iter != aAnnotations.end(); iter++ ) { @@ -580,14 +580,14 @@ void AnnotationManagerImpl::DeleteAllAnnotations() 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) ); + pPage->removeAnnotation( (*iter) ); } } } @@ -604,31 +604,31 @@ void AnnotationManagerImpl::DeleteAllAnnotations() 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.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 ); + rSet.DisableItem( SID_DELETE_POSTIT ); SdPage* pPage = 0; - + bool bHasAnnotations = false; do { pPage = GetNextPage( pPage, true ); - - if( pPage && !pPage->getAnnotations().empty() ) + + if( pPage && !pPage->getAnnotations().empty() ) bHasAnnotations = true; } while( pPage && !bHasAnnotations ); @@ -636,7 +636,7 @@ void AnnotationManagerImpl::GetAnnotationState(SfxItemSet& rSet) if( !bHasAnnotations || bReadOnly ) { rSet.DisableItem( SID_DELETEALL_POSTIT ); - } + } if( bWrongPageKind || !bHasAnnotations ) { @@ -684,7 +684,7 @@ void AnnotationManagerImpl::SelectNextAnnotation(bool bForeward) } } else - { + { if( xCurrent.is() ) { for( AnnotationVector::iterator iter = aAnnotations.begin(); iter != aAnnotations.end(); iter++ ) @@ -703,7 +703,7 @@ void AnnotationManagerImpl::SelectNextAnnotation(bool bForeward) } } else if( !aAnnotations.empty() ) - { + { AnnotationVector::iterator iter( aAnnotations.end() ); SelectAnnotation( *(--iter) ); return; @@ -716,8 +716,8 @@ void AnnotationManagerImpl::SelectNextAnnotation(bool bForeward) do { pPage = GetNextPage( pPage, bForeward ); - - if( pPage && !pPage->getAnnotations().empty() ) + + if( pPage && !pPage->getAnnotations().empty() ) { // switch to next/previous slide with annotations ::boost::shared_ptr<DrawViewShell> pDrawViewShell(::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell())); @@ -725,17 +725,17 @@ void AnnotationManagerImpl::SelectNextAnnotation(bool bForeward) { 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; @@ -760,7 +760,7 @@ void AnnotationManagerImpl::SelectNextAnnotation(bool bForeward) // -------------------------------------------------------------------- -void AnnotationManagerImpl::onTagSelected( AnnotationTag& rTag ) +void AnnotationManagerImpl::onTagSelected( AnnotationTag& rTag ) { mxSelectedAnnotation = rTag.GetAnnotation(); invalidateSlots(); @@ -780,14 +780,14 @@ void AnnotationManagerImpl::onTagDeselected( AnnotationTag& rTag ) // -------------------------------------------------------------------- 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() ); + SmartTagReference xTag( (*iter).get() ); mrBase.GetMainViewShell()->GetView()->getSmartTags().select( xTag ); (*iter)->OpenPopup( bEdit ); break; @@ -811,8 +811,8 @@ void AnnotationManagerImpl::invalidateSlots() 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_NEXT_POSTIT ); + pBindings->Invalidate( SID_UNDO ); pBindings->Invalidate( SID_REDO ); } } @@ -828,9 +828,9 @@ void AnnotationManagerImpl::onSelectionChanged() if( xPage != mxCurrentPage ) { mxCurrentPage = xPage; - + UpdateTags(true); - } + } } catch( Exception& ) { @@ -844,7 +844,7 @@ void AnnotationManagerImpl::UpdateTags( bool bSynchron ) { if( mnUpdateTagsEvent ) Application::RemoveUserEvent( mnUpdateTagsEvent ); - + UpdateTagsHdl(0); } else @@ -858,15 +858,15 @@ IMPL_LINK(AnnotationManagerImpl,UpdateTagsHdl, void *, EMPTYARG) { mnUpdateTagsEvent = 0; DisposeTags(); - + if( mbShowAnnotations ) CreateTags(); - + if( mrBase.GetDrawView() ) - static_cast< ::sd::View* >( mrBase.GetDrawView() )->updateHandles(); + static_cast< ::sd::View* >( mrBase.GetDrawView() )->updateHandles(); invalidateSlots(); - + return 0; } @@ -879,7 +879,7 @@ void AnnotationManagerImpl::CreateTags() maFont = Application::GetSettings().GetStyleSettings().GetAppFont(); rtl::Reference< AnnotationTag > xSelectedTag; - + Reference< XAnnotationEnumeration > xEnum( mxCurrentPage->createAnnotationEnumeration() ); while( xEnum->hasMoreElements() ) { @@ -887,16 +887,16 @@ void AnnotationManagerImpl::CreateTags() 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() ); + SmartTagReference xTag( xSelectedTag.get() ); mrBase.GetMainViewShell()->GetView()->getSmartTags().select( xTag ); } else @@ -923,7 +923,7 @@ void AnnotationManagerImpl::DisposeTags() (*iter++)->Dispose(); } while( iter != maTagVector.end() ); - + maTagVector.clear(); } } @@ -979,29 +979,29 @@ void AnnotationManagerImpl::ExecuteAnnotationContextMenu( Reference< XAnnotation 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 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 ); + pMenu->EnableItem( SID_DELETE_POSTIT, (xAnnotation.is() && !bReadOnly) ? TRUE : FALSE ); + pMenu->EnableItem( SID_DELETEALLBYAUTHOR_POSTIT, !bReadOnly ); + pMenu->EnableItem( SID_DELETEALL_POSTIT, !bReadOnly ); if( pAnnotationWindow ) { @@ -1016,18 +1016,18 @@ void AnnotationManagerImpl::ExecuteAnnotationContextMenu( Reference< XAnnotation 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 ) { @@ -1043,12 +1043,12 @@ void AnnotationManagerImpl::ExecuteAnnotationContextMenu( Reference< XAnnotation 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() ) @@ -1056,12 +1056,12 @@ void AnnotationManagerImpl::ExecuteAnnotationContextMenu( Reference< XAnnotation const bool bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); for( USHORT nPos = 0; nPos < pMenu->GetItemCount(); nPos++ ) { - nId = pMenu->GetItemId( 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 ); @@ -1092,10 +1092,10 @@ void AnnotationManagerImpl::ExecuteAnnotationContextMenu( Reference< XAnnotation } case SID_DELETEALL_POSTIT: pDispatcher->Execute( SID_DELETEALL_POSTIT ); - break; + break; case SID_COPY: case SID_PASTE: - case SID_ATTR_CHAR_WEIGHT: + case SID_ATTR_CHAR_WEIGHT: case SID_ATTR_CHAR_POSTURE: case SID_ATTR_CHAR_UNDERLINE: case SID_ATTR_CHAR_STRIKEOUT: @@ -1112,9 +1112,9 @@ 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 }; + 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 % (SAL_N_ELEMENTS(aArrayNormal))]); } @@ -1127,9 +1127,9 @@ 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 }; + 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 % (SAL_N_ELEMENTS(aArrayLight))]); } @@ -1142,9 +1142,9 @@ 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 }; + 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 % (SAL_N_ELEMENTS(aArrayAnkor))]); } @@ -1156,14 +1156,14 @@ 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) @@ -1175,15 +1175,15 @@ SdPage* AnnotationManagerImpl::GetNextPage( SdPage* pPage, bool bForeward ) { if( nPageNum == 0 ) return 0; // we are already on the first draw page, finished - - nPageNum--; + + 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 @@ -1196,12 +1196,12 @@ SdPage* AnnotationManagerImpl::GetNextPage( SdPage* pPage, bool bForeward ) { // we reached beginning of master pages, start with end if pages return mpDoc->GetSdPage( mpDoc->GetSdPageCount(PK_STANDARD)-1, PK_STANDARD ); - } - - nPageNum--; + } + + nPageNum--; } return mpDoc->GetMasterSdPage(nPageNum,PK_STANDARD); - } + } } SdPage* AnnotationManagerImpl::GetFirstPage() diff --git a/sd/source/ui/annotations/annotationmanagerimpl.hxx b/sd/source/ui/annotations/annotationmanagerimpl.hxx index cf0cd20a9163..01a6cd6b3586 100644 --- a/sd/source/ui/annotations/annotationmanagerimpl.hxx +++ b/sd/source/ui/annotations/annotationmanagerimpl.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -50,34 +50,34 @@ 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 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 ); @@ -89,16 +89,16 @@ public: 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 onTagSelected( AnnotationTag& rTag ); void onTagDeselected( AnnotationTag& rTag ); - + void onSelectionChanged(); void addListener(); @@ -116,18 +116,18 @@ public: SdPage* GetNextPage( SdPage* pPage, bool bForeward ); SdPage* GetFirstPage(); SdPage* GetLastPage(); - + SdPage* GetCurrentPage(); SdDrawDocument* GetDoc() { return mpDoc; } - + void ShowAnnotations(bool bShow); - + private: ViewShellBase& mrBase; SdDrawDocument* mpDoc; - - AnnotationTagVector maTagVector; + + AnnotationTagVector maTagVector; ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView; ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotationAccess > mxCurrentPage; diff --git a/sd/source/ui/annotations/annotations.hrc b/sd/source/ui/annotations/annotations.hrc index d2969f91be41..c3f82ea3d271 100644 --- a/sd/source/ui/annotations/annotations.hrc +++ b/sd/source/ui/annotations/annotations.hrc @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -31,35 +31,35 @@ #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) +#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 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 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 TBX_TOOLBAR 1 +#define FT_AUTHOR 1 +#define ED_AUTHOR 2 +#define FT_DATE 3 +#define ED_DATE 4 -#define CT_TEXT 5 +#define CT_TEXT 5 #endif // _SD_ANNOTATIONPANE_HRC diff --git a/sd/source/ui/annotations/annotations.src b/sd/source/ui/annotations/annotations.src index 0ca43731d6b0..369bd02a46ae 100644 --- a/sd/source/ui/annotations/annotations.src +++ b/sd/source/ui/annotations/annotations.src @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -70,7 +70,7 @@ Menu RID_ANNOTATION_CONTEXTMENU MenuItem { Separator = TRUE; - }; + }; MenuItem { Identifier = SID_COPY ; @@ -121,7 +121,7 @@ Menu RID_ANNOTATION_TAG_CONTEXTMENU MenuItem { Separator = TRUE; - }; + }; MenuItem { Identifier = SID_DELETE_POSTIT ; diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index 94ac807ece4d..586a25d48fcc 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -91,7 +91,7 @@ static OUString getInitials( const OUString& rName ) // take letter if( nLength ) { - sInitials += OUString( *pStr ); + sInitials += OUString( *pStr ); nLength--; pStr++; } @@ -143,10 +143,10 @@ bool AnnotationDragMove::BeginSdrDrag() void AnnotationDragMove::MoveSdrDrag(const Point& rNoSnapPnt) { Point aPnt(rNoSnapPnt); - - if (DragStat().CheckMinMoved(rNoSnapPnt)) + + if (DragStat().CheckMinMoved(rNoSnapPnt)) { - if (aPnt!=DragStat().GetNow()) + if (aPnt!=DragStat().GetNow()) { Hide(); DragStat().NextMove(aPnt); @@ -213,12 +213,12 @@ void AnnotationHdl::CreateB2dIAObject() 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 ) @@ -250,18 +250,18 @@ void AnnotationHdl::CreateB2dIAObject() const sal_uInt32 nBlinkTime = sal::static_int_cast<sal_uInt32>(rStyleSettings.GetCursorBlinkTime()); pOverlayObject = new ::sdr::overlay::OverlayAnimatedBitmapEx(aPosition, aBitmapEx, aBitmapEx2, nBlinkTime, 0, 0, 0, 0 ); -/* - (UINT16)(aBitmapEx.GetSizePixel().Width() - 1) >> 1, +/* + (UINT16)(aBitmapEx.GetSizePixel().Width() - 1) >> 1, (UINT16)(aBitmapEx.GetSizePixel().Height() - 1) >> 1, - (UINT16)(aBitmapEx2.GetSizePixel().Width() - 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); } @@ -351,21 +351,21 @@ bool AnnotationTag::MouseButtonDown( const MouseEvent& rMEvt, SmartHdl& /*rHdl*/ } 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)); + mpListenWindow->AddEventListener( LINK(this, AnnotationTag, WindowEventHandler)); } bRet = true; - } + } return bRet; } @@ -418,40 +418,40 @@ 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<long>(aPosition.X * 100.0), static_cast<long>(aPosition.Y * 100.0) ) ) ); - Rectangle aRect( aPos, maSize ); + 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; +*/ + 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 ); + mrManager.ExecuteAnnotationContextMenu( mxAnnotation, pWindow, aContextRect ); return true; } } - - return false; + + return false; } void AnnotationTag::Move( int nDX, int nDY ) @@ -460,7 +460,7 @@ void AnnotationTag::Move( int nDX, int nDY ) { 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; @@ -480,10 +480,10 @@ bool AnnotationTag::OnMove( const KeyEvent& rKEvt ) 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; + 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; } @@ -598,15 +598,15 @@ void AnnotationTag::disposing() void AnnotationTag::select() { SmartTag::select(); - + mrManager.onTagSelected( *this ); - + Window* pWindow = mrView.GetViewShell()->GetActiveWindow(); if( pWindow ) { RealPoint2D aPosition( mxAnnotation->getPosition() ); Point aPos( static_cast<long>(aPosition.X * 100.0), static_cast<long>(aPosition.Y * 100.0) ); - + Rectangle aVisRect( aPos, pWindow->PixelToLogic(maSize) ); mrView.MakeVisible(aVisRect, *pWindow); } @@ -618,7 +618,7 @@ void AnnotationTag::deselect() { SmartTag::deselect(); - ClosePopup(); + ClosePopup(); mrManager.onTagDeselected( *this ); } @@ -675,37 +675,37 @@ 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<long>(aPosition.X * 100.0), static_cast<long>(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.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(); } @@ -725,7 +725,7 @@ IMPL_LINK(AnnotationTag, WindowEventHandler, VclWindowEvent*, pEvent) if( pEvent != NULL ) { ::Window* pWindow = pEvent->GetWindow(); - + if( pWindow ) { if( pWindow == mpAnnotationWindow.get() ) @@ -734,7 +734,7 @@ IMPL_LINK(AnnotationTag, WindowEventHandler, VclWindowEvent*, pEvent) { if( mnClosePopupEvent ) Application::RemoveUserEvent( mnClosePopupEvent ); - + mnClosePopupEvent = Application::PostUserEvent( LINK( this, AnnotationTag, ClosePopupHdl ) ); } } @@ -755,16 +755,16 @@ IMPL_LINK(AnnotationTag, WindowEventHandler, VclWindowEvent*, pEvent) { // if we move the mouse after a button down we wan't to start draging mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler)); - mpListenWindow = 0; + 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 ); } @@ -773,7 +773,7 @@ IMPL_LINK(AnnotationTag, WindowEventHandler, VclWindowEvent*, pEvent) case VCLEVENT_OBJECT_DYING: mpListenWindow = 0; break; - } + } } } } diff --git a/sd/source/ui/annotations/annotationtag.hxx b/sd/source/ui/annotations/annotationtag.hxx index e37ae2057d3f..5f2e2ba89f71 100644 --- a/sd/source/ui/annotations/annotationtag.hxx +++ b/sd/source/ui/annotations/annotationtag.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -78,7 +78,7 @@ public: void OpenPopup( bool bEdit ); void ClosePopup(); - + protected: virtual void addCustomHandles( SdrHdlList& rHandlerList ); virtual bool getContext( SdrViewContext& rContext ); @@ -88,14 +88,14 @@ protected: DECL_LINK( WindowEventHandler, VclWindowEvent* ); DECL_LINK( ClosePopupHdl, void* ); - + private: AnnotationManagerImpl& mrManager; css::uno::Reference< css::office::XAnnotation > mxAnnotation; std::auto_ptr<AnnotationWindow> mpAnnotationWindow; - Color maColor; - int mnIndex; - const Font& mrFont; + Color maColor; + int mnIndex; + const Font& mrFont; Size maSize; ULONG mnClosePopupEvent; ::Window* mpListenWindow; @@ -104,6 +104,6 @@ private: } // end of namespace sd -#endif // _SD_ANNOTATIONTAG_HXX_ +#endif // _SD_ANNOTATIONTAG_HXX_ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx index 182960a01d2a..7295e7187be2 100644 --- a/sd/source/ui/annotations/annotationwindow.cxx +++ b/sd/source/ui/annotations/annotationwindow.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -77,7 +77,7 @@ #include <vcl/button.hxx> #include <vcl/svapp.hxx> #include <vcl/gradient.hxx> -#include <vcl/salbtype.hxx> // FRound +#include <vcl/salbtype.hxx> // FRound #include <vcl/cursor.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> @@ -102,12 +102,12 @@ 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 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("")) +#define EMPTYSTRING rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")) namespace sd { @@ -117,9 +117,9 @@ 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))); + 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 **********************************/ @@ -324,8 +324,8 @@ void AnnotationWindow::InitControls() mpMeta->AlwaysDisableInput(true); mpMeta->SetCallHandlersOnInputDisabled(true); -// mpMeta->AddEventListener( LINK( mpPostItTxt, PostItTxt, WindowEventListener ) ); -// AddEventListener( LINK( mpTextWindow, PostItTxt, WindowEventListener ) ); +// 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 @@ -353,9 +353,9 @@ void AnnotationWindow::InitControls() 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); +// 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; @@ -367,7 +367,7 @@ void AnnotationWindow::InitControls() mpVScrollbar->EnableRTL( false ); mpVScrollbar->SetScrollHdl(LINK(this, AnnotationWindow, ScrollHdl)); mpVScrollbar->EnableDrag(); -// mpVScrollbar->AddEventListener( LINK( this, AnnotationWindow, WindowEventListener ) ); +// mpVScrollbar->AddEventListener( LINK( this, AnnotationWindow, WindowEventListener ) ); ULONG nCntrl = mpOutliner->GetControlWord(); nCntrl |= EE_CNTRL_PASTESPECIAL | EE_CNTRL_AUTOCORRECT | EV_CNTRL_AUTOSCROLL | EE_CNTRL_NOCOLORS; @@ -382,7 +382,7 @@ void AnnotationWindow::InitControls() nCntrl &= ~EE_CNTRL_ONLINESPELLING; */ mpOutliner->SetControlWord(nCntrl); -// mpOutliner->SetFlatMode( TRUE ); +// mpOutliner->SetFlatMode( TRUE ); Engine()->SetModifyHdl( Link() ); Engine()->EnableUndo( FALSE ); @@ -428,14 +428,14 @@ void AnnotationWindow::Rescale() void AnnotationWindow::DoResize() { - unsigned long aWidth = GetSizePixel().Width(); - long aHeight = GetSizePixel().Height() - POSTIT_META_HEIGHT; + unsigned long aWidth = GetSizePixel().Width(); + long aHeight = GetSizePixel().Height() - POSTIT_META_HEIGHT; mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ; - long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height(); + long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height(); if( aTextHeight > aHeight ) - { // we need vertical scrollbars and have to reduce the width + { // we need vertical scrollbars and have to reduce the width aWidth -= GetScrollbarWidth(); mpVScrollbar->Show(); } @@ -454,7 +454,7 @@ void AnnotationWindow::DoResize() 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 + { // 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 ); @@ -552,7 +552,7 @@ IMPL_LINK(AnnotationWindow, ModifyHdl, void*, EMPTYARG) sal_Int32 AnnotationWindow::GetScrollbarWidth() { return 16; -// return mpView->GetWrtShell().GetViewOptions()->GetZoom() / 10; +// return mpView->GetWrtShell().GetViewOptions()->GetZoom() / 10; } SvxLanguageItem AnnotationWindow::GetLanguage(void) diff --git a/sd/source/ui/annotations/annotationwindow.hxx b/sd/source/ui/annotations/annotationwindow.hxx index 33efb1e3c2fc..ab13eaa82fb4 100644 --- a/sd/source/ui/annotations/annotationwindow.hxx +++ b/sd/source/ui/annotations/annotationwindow.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -63,28 +63,28 @@ class View; class AnnotationTextWindow : public Control { private: - OutlinerView* mpOutlinerView; - AnnotationWindow* mpAnnotationWindow; + 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(); + 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(); + virtual void GetFocus(); }; @@ -92,24 +92,24 @@ class AnnotationWindow : public FloatingWindow { private: AnnotationManagerImpl& mrManager; - DrawDocShell* mpDocShell; - View* mpView; - SdDrawDocument* mpDoc; + DrawDocShell* mpDocShell; + View* mpView; + SdDrawDocument* mpDoc; - OutlinerView* mpOutlinerView; - Outliner* mpOutliner; - ScrollBar* mpVScrollbar; + 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; + Rectangle maRectMetaButton; basegfx::B2DPolygon maPopupTriangle; - protected: - void SetSizePixel( const Size& rNewSize ); + protected: + void SetSizePixel( const Size& rNewSize ); DECL_LINK(ModifyHdl, void*); DECL_LINK(ScrollHdl, ScrollBar*); @@ -119,46 +119,46 @@ class AnnotationWindow : public FloatingWindow virtual ~AnnotationWindow(); void StartEdit(); - - virtual SvxLanguageItem GetLanguage(void); - + + 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;} - 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; } + 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 InitControls(); void HidePostIt(); void DoResize(); - void ResizeIfNeccessary(long aOldHeight, long aNewHeight); - void SetScrollbar(); + void ResizeIfNeccessary(long aOldHeight, long aNewHeight); + void SetScrollbar(); - void Rescale(); + void Rescale(); - bool IsReadOnly() { return mbReadonly;} + bool IsReadOnly() { return mbReadonly;} bool IsProtected() { return mbProtected; } - void SetLanguage(const SvxLanguageItem aNewItem); + void SetLanguage(const SvxLanguageItem aNewItem); - sal_Int32 GetScrollbarWidth(); + sal_Int32 GetScrollbarWidth(); - void ToggleInsMode(); + void ToggleInsMode(); DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*); - - virtual void Deactivate(); - virtual void Paint( const Rectangle& rRect); + + 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 ); @@ -166,9 +166,9 @@ class AnnotationWindow : public FloatingWindow void SetColor(); - Color maColor; - Color maColorDark; - Color maColorLight; + Color maColor; + Color maColorDark; + Color maColorLight; }; } // namespace sd |